强制删除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”) }’

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章