Reputation: 9826
If Pod's status is Failed
, Kubernetes will try to create new Pods until it reaches terminated-pod-gc-threshold
in kube-controller-manager
. This will leave many Failed
Pods in a cluster and need to be cleaned up.
Are there other reasons except Evicted
that will cause Pod Failed
?
Upvotes: 5
Views: 16848
Reputation: 14102
PODs will not survive scheduling failures, node failures, or other evictions, such as lack of resources, or in the case of node maintenance. Pods should not be created manually but almost always via controllers like Deployments (self-healing, replication etc).
Reason why pod failed or was terminated can be obtain by
kubectl describe pod <pod_name>
Others situation I have encountered when pod Failed:
In addition, eviction is based on resources - EvictionPolicy
It can be also caused by DRAINing the Node/Pod. You can read about DRAIN here.
Upvotes: 2
Reputation: 981
There can be many causes for the POD status to be FAILED
. You just need to check for problems(if there exists any) by running the command
kubectl -n <namespace> describe pod <pod-name>
Carefully check the EVENTS
section where all the events those occurred during POD creation are listed. Hopefully you can pinpoint the cause of failure from there.
However there are several reasons for POD failure, some of them are the following:
In the above example, the image "not-so-busybox" couldn't be pulled as it doesn't exist, so the pod FAILED to run. The pod status and events clearly describe the problem.
Upvotes: 6
Reputation: 597
Simply do this:
kubectl get pods <pod_name> -o yaml
And in the output, towards the end, you can see something like this:
This will give you a good idea of where exactly did the pod fail and what happened.
Upvotes: 4