删除k8s集群中所有Evicted状态的Pod

2022-06-28  本文已影响0人  baiyongjie

以下两条命令 直接复制执行即可

kubectl get pods -A |grep Evicted |awk '{print "kubectl delete pods -n " $1,$2}' | bash
for i in `kubectl get pods -A | grep Evicted | awk '{print $1}' |uniq`;do for j in `kubectl get pods -n $i |grep Evicted|awk '{print $1}'`; do kubectl delete pods -n $i $j; done; done
上一篇 下一篇

猜你喜欢

热点阅读