搭配grep,awk強制刪除k8s中,所有非Running狀態的pod
kubectl get pods --all-namespaces -o wide | grep -v Running | grep -v NAME | awk '{print $1 " " $2}' | while read namespace podname; do kubectl delete -n $namespace pod $namespace --grace-period=0 --force; done
搭配grep,awk強制刪除k8s中,所有非Running狀態的pod
kubectl get pods --all-namespaces -o wide | grep -v Running | grep -v NAME | awk '{print $1 " " $2}' | while read namespace podname; do kubectl delete -n $namespace pod $namespace --grace-period=0 --force; done