How do I delete Errored or Evicted pods?
Purpose
In situations such as the following, one or more NSP pods may enter the Errored or Evicted state. The NSP raises an alarm against each such pod, and a CLI query displays them, as shown below:
namespace pod_a 1/1 Running 0 18m
namespace pod_b 1/1 Errored 0 18m
namespace pod_c 0/1 Evicted 0 19m
An Errored pod is typically the result of an unplanned VM reboot.
A pod is typically Evicted because of insufficient storage space on the host node, which is often called disk pressure.
In either case, the Kubernetes orchestrater reschedules the pod to a different node in the NSP cluster.
Each Errored or Evicted pod is preserved for forensic analysis, but consumes no host resources. When the investigation of the pod failure is complete, you can safely delete the preserved pod.
Perform the following procedure to delete all Errored or Evicted pods in an NSP cluster.
Steps
1 |
Log in as the root or NSP admin user on the NSP cluster host. |
2 |
Open a console window. |
3 |
Enter the following to list the pods in the NSP cluster. # kubectl get pods -A ↵ The pods are listed. |
4 |
Enter the following: # kubectl get pods -A | awk '$4 ~ /Evicted|Error/{print $1, $2}' | xargs -n 2 kubectl delete pod -n ↵ Each Errored or Evicted pod is deleted. |
5 |
Enter the following: # kubectl get pods -A ↵ The pods are listed. |
6 |
Verify that no Errored or Evicted pods remain in the cluster. |
7 |
Close the console window. End of steps |