016K8S批量命令操作集合

一、批量删除异常pod

#批量删除被驱逐的pod:
kubectl get pods --all-namespaces | grep Evicted | awk '{print $1 " " $2}' | while read ns pod; do kubectl delete pod $pod -n $ns; done

#批量删除错误的pod:
kubectl get pods --all-namespaces | grep Error | awk '{print $1 " " $2}' | while read ns pod; do kubectl delete pod $pod -n $ns; done

 

posted @ 2024-04-15 11:03  arun_yh  阅读(96)  评论(0编辑  收藏  举报