Created
June 19, 2017 08:57
-
Star
(277)
You must be signed in to star a gist -
Fork
(37)
You must be signed in to fork a gist
-
-
Save ipedrazas/9c622404fb41f2343a0db85b3821275d to your computer and use it in GitHub Desktop.
Delete evicted pods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod |
Why doesn't Kubernetes clean up Evicted pods by itself? I only notice it happen sometimes.
My understanding is that there is a threshold for cleaning up - when the number of failed hits that threshold then clean up will happen - the challenge is that the default for that is 12500 (twelve thousand five hundred). The purpose of the threshold is to allow for review of the reasons for failure and I can see that in a large system that might almost be a reasonable number.
That threshold can be changed - I'm not sure what a sensible number would look like for a small cluster.
kubectl get pod -A | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs -n 2 kubectl delete pod
work for me
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great answer, thanks!