Skip to content

Instantly share code, notes, and snippets.

@paddy74
Created September 3, 2020 17:25
Show Gist options
  • Save paddy74/4c0e4832a9aa3cd201dccbda2673b18c to your computer and use it in GitHub Desktop.
Save paddy74/4c0e4832a9aa3cd201dccbda2673b18c to your computer and use it in GitHub Desktop.
Clean bad pods from kubernetes
#!/bin/bash
kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
#kubectl get pods --all-namespaces --field-selector 'status.phase==Failed' -o json | kubectl delete -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment