强制删除k8s不正常状态的容器

1.强制删除特定pods
#kubectl delete pods cloudagile-mariadb-0 -n intelligence-data-lab –grace-period=0 --force
2.删除集群失败的pods
#kubectl get pods --field-selector=status.phase=Failed --all-namespaces |awk ‘{ system("kubectl delete pod “$2” -n "$1) }’
3.强制删除Terminating状态的pods
#kubectl get pods --all-namespaces |grep Terminating||grep -w “0/1”|awk ‘{ system(“kubectl delete pod “$2” -n “$1” --grace-period=0 --force”) }’

猜你喜欢

转载自blog.csdn.net/lyf0327/article/details/89853269