0

I have a cluster created in GCP with autoscaling enabled on the cluster. In my case, few pods are getting evicted from node A due to Memory Pressure and are running on new node B. But the evicted pods are not getting removed. Its still visible when I run 'kubectl get pods'. Is this an expected behavior? Do these evicted pods consume any resources or cause any other issue, if not deleted/removed?

1 Answers1

1

That's perfectly normal. Seeing the pods there with the error helps you troubleshoot errors / failures. If they were auto deleted, you'd never know.

If it is not running, it is not consuming resources.

You can do something like the command below to clear them if it bothers you.

kubectl delete pod $(kubectl get pods | grep Error | awk '{print $1}')

In this case replace 'Error' with whatever state you want to clear.

shrumm
  • 116
  • 1
  • 9
  • 1
    A one liner to delete all evicted pods across all namespaces - https://github.com/kubernetes/kubernetes/issues/55051#issuecomment-342503382 – Daniel t. Sep 29 '19 at 01:32