Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@flickerfly
Created July 28, 2020 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flickerfly/8fc0f9771d10063391872f62db3cb210 to your computer and use it in GitHub Desktop.
Save flickerfly/8fc0f9771d10063391872f62db3cb210 to your computer and use it in GitHub Desktop.
Delete all Evicted pods across namespaces
# Requires kubectl and jq
kubectl get po -a --all-namespaces -o json | \
jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) |
"kubectl delete po \(.metadata.name) -n \(.metadata.namespace)"' | xargs -n1 bash -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment