Kubernetes has a ton of pods in error state that can't seem to be cleared Kubernetes has a ton of pods in error state that can't seem to be cleared kubernetes kubernetes

Kubernetes has a ton of pods in error state that can't seem to be cleared


kubectl delete pods --field-selector status.phase=Failed -n <your-namespace>

...cleans up any failed pods in your-namespace.


Here you are a quick way to fix it :)

kubectl get pods | grep Error | cut -d' ' -f 1 | xargs kubectl delete pod

Edit: Add flag -a if you are using an old version of k8s


I usually remove all the Error pods with this command.kubectl delete pod `kubectl get pods --namespace <yournamespace> | awk '$3 == "Error" {print $1}'` --namespace <yournamespace>