Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pvsousalima/2a2d1ab9e72434aedb83a0a8c1de54e7 to your computer and use it in GitHub Desktop.
Save pvsousalima/2a2d1ab9e72434aedb83a0a8c1de54e7 to your computer and use it in GitHub Desktop.
Kubernetes delete all evicted pods in a cluster
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 -n 1 bash -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment