kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
=== 删除所有被驱逐的 pod(所有 namespace) ===
keyword="Evicted"
namespaces=`kubectl get namespaces | awk '{print $1}' | grep -v NAME`
for namespace in $namespaces
do
echo "cleaning $keyword pod in $namespace"
kubectl delete pod $(kubectl get pods -n $namespace | grep $keyword | awk '{print $1}') -n $namespace
done
=== 查看所有命名空间的 pod ===
k get po --all-namespaces