Kubernetes – Status: Evicted

The status "Evicted" means that Pod was "evicted" from the node, as he lacked the resources. This can be observed if you display the following:

kubectl get pod -n staging
NAME                                      READY   STATUS             RESTARTS   AGE
artem-client-app-5bb855b7-ccfmz           1/1     Running            0          63m
artem-instance-app-64584c56d4-4g5qh       0/1     Evicted            0          16m
artem-instance-app-64584c56d4-knc9z       0/1     Evicted            0          16m
artem-instance-app-64584c56d4-ld8h9       0/1     Evicted            0          25m
artem-instance-app-64584c56d4-lstt9       0/1     Evicted            0          16m
artem-instance-app-64584c56d4-sksrg       0/1     Evicted            0          16m
artem-instance-app-c67d9b8b9-7ppsg        1/1     Running            0          14m

 

In order to remove all pods in the status "Evicted", do the following:

kubectl get pods --all-namespaces -o json | jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) | "kubectl delete pods \(.metadata.name) -n \(.metadata.namespace)"' | xargs -n 1 bash -c

Tagged: Tags

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments