Skip to content

Instantly share code, notes, and snippets.

@rayrutjes
Created July 19, 2018 13:37
Show Gist options
  • Save rayrutjes/62ca0c042203273a11421774d78f03cb to your computer and use it in GitHub Desktop.
Save rayrutjes/62ca0c042203273a11421774d78f03cb to your computer and use it in GitHub Desktop.
Cleanup evicted pods - Kubernetes
kubectl get pod -a --all-namespaces -o json \
| jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) | "kubectl delete pod \(.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