強制刪除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”) }’

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