Skip to content

Instantly share code, notes, and snippets.

@saidsef
Last active September 20, 2018 21:44
Show Gist options
  • Select an option

  • Save saidsef/c2a17c1a0428de203a4d32a16eccedd8 to your computer and use it in GitHub Desktop.

Select an option

Save saidsef/c2a17c1a0428de203a4d32a16eccedd8 to your computer and use it in GitHub Desktop.
Kubernetes cleanup evicted pods across all namespaces
# Qucik way to cleanup evicted pods across all namespaces
# Long term fix: https://kubernetes.io/docs/tasks/administer-cluster/out-of-resource/
for NS in `kubectl get ns | grep -v NAME | awk '{ print $1 }'`; do
kubectl get all -n $NS | grep -i evicted | awk '{ print $1 }' | while read f; do kubectl delete -n $NS $f; done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment