k8s 删除Evicted状态的pod

查找状态异常的pod

kubectl get pod -A|grep Evicted|awk '{print "kubectl delete pod -n cattle-system  "$2}' > aaaa.sh
cat 
kubectl get pod -A|grep Terminating|awk '{print "kubectl delete pod -n gaplus-test --force --grace-period=0  "$2}' > aaaa.sh


删除pod

sh aaaa.sh

通过grep 计算有多少pod异常

kubectl get pod -A |grep Evicted |wc -l
posted @ 2021-06-23 14:22  leechg  阅读(629)  评论(0编辑  收藏  举报