What Should I Do If a Pod Is in the Evicted State?

Problem

Workload pods in the cluster fail and are being redeployed constantly.

After the following command is run, the command output shows that many pods are in the evicted state.

kubectl get pods

Possible Cause

When a node is abnormal, Kubernetes evicts pods on the node. This problem is often caused by insufficient resources.

Solution

Check resource usage and locate the fault.

Run the following command to delete the evicted pods:

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod

Reference

Kubelet does not delete evicted pods