k8s 强制删除pod kubectl -n kube-system delete pod traefik-ingress --force --grace-period=0

kubectl -n kube-system delete pod     traefik-ingress-lb-bc45b7649-rvgxd --force --grace-period=0

 

kubectl get pod|awk -F'[ ]+'   '$3~/Terminating/{print $1}'|xargs -n1 kubectl delete pod  --force --grace-period=0

kubectl get pod|awk -F'[ ]+'   '$3~/Terminating|Evicted/{print $1}'|xargs -n1 kubectl delete pod  --force --grace-period=0 



删除所有命名空间中pod状态不正常的pod

for i in `kubectl get ns|awk -F'[ ]+' 'NR>=2{print $1}'`;do kubectl get pod -n $i|awk -F'[ ]+' '$3~/Terminating|Evicted|OutOfcpu/{print $1}'|xargs -n1 kubectl delete pod --force --grace-period=0 -n $i;done

 

 

 

https://v1-16.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.16/

posted @ 2021-01-25 09:47  滴滴滴  阅读(1572)  评论(0编辑  收藏  举报