Skip to content

Instantly share code, notes, and snippets.

@jamesholcomb
Forked from zparnold/one_liner.sh
Created October 12, 2022 14:21
Show Gist options
  • Save jamesholcomb/7a19247f2b773e36d9da8451fe887dc2 to your computer and use it in GitHub Desktop.
Save jamesholcomb/7a19247f2b773e36d9da8451fe887dc2 to your computer and use it in GitHub Desktop.
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
@jamesholcomb
Copy link
Author

deletes status = Terminated and NodeShutdown

kubectl delete pods -A --field-selector=status.phase=Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment