diff --git a/delete_evicted.sh b/delete_evicted.sh index 4449816..8efc708 100644 --- a/delete_evicted.sh +++ b/delete_evicted.sh @@ -1,3 +1,3 @@ #!/bin/bash -kubectl get po --all-namespaces | awk '{if ($4 ~ /Evicted/) system ("kubectl -n " $1 " delete pods " $2)}' + kubectl get pods --all-namespaces --field-selector 'status.phase==Failed' -o json | kubectl delete -f -