Kubernetes 批量删除

发现很多状态为 Evicted 的 pod:

$ kubectl get pods

NAME          READY   STATUS    RESTARTS   AGE
mysql-2zn56   0/1     Pending   0          118s
mysql-6kwqz   0/1     Evicted   0          118s
mysql-75z6v   0/1     Evicted   0          3m55s
mysql-7jdxj   0/1     Evicted   0          2m
mysql-f2vj2   0/1     Evicted   0          119s
mysql-g282j   0/1     Evicted   0          119s
mysql-g9g5z   0/1     Evicted   0          2m1s
mysql-ggwtw   0/1     Evicted   0          2m1s
...

批量删除:

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod

你可能感兴趣的:(Kubernetes 批量删除)