清理非running 的pod
kubectl get pod -o wide --all-namespaces | awk '{if($4!="Running"){cmd="kubectl -n "$1" delete pod "$2; system(cmd)}}'
清理非Evicted 的pod
kubectl get pod -o wide --all-namespaces | awk '{if($4=="Evicted"){cmd="kubectl -n "$1" delete pod "$2; system(cmd)}}'
后面陆续更新
标签:kubectl,批量,get,cmd,system,awk,pod,k8s From: https://blog.51cto.com/zhaochengsheng/5937936