Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 15below-adamhancock/a82ab913f07132232c058596a899d582 to your computer and use it in GitHub Desktop.
Save 15below-adamhancock/a82ab913f07132232c058596a899d582 to your computer and use it in GitHub Desktop.
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod -n 15below
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment