CrasLoopBackOff is the most common problem, and it means that your pod is starting and crashing continuously.
Why is this happening?
The possible reasons are:
- the application inside your pod is not starting due to an error;
- the image your pod is based on is not present in the registry, or the node where your pod has been scheduled cannot pull from the registry;
- some parameters of the pod has not been configured correctly.
How to find the reason?
Retrieve the pod name:
kubectl get po -n mynamespace
NAME READY STATUS RESTARTS AGE
nginx-40395h6810-j90ed 1/1 Running 1 12d
mypod-390jo50wn3-sp40r 0/1 CrashLoopBackOff 2 1m
Then look at the logs of the pod:
kubectl logs mypod-390jo50wn3-sp40r -n mynamespace
If checking the logs is not enough and you can't find the reason of the error, you can look at kubernetes events:
kubectl get events -n mynamespace
You can see the events also describing the pod:
kubectl describe po mypod-390jo50wn3-sp40r -n mynamespace
Name: mypod-390jo50wn3-sp40r
Namespace: mynamespace
Node: ip-10-10-8-68.eu-west-1.compute.internal/10.10.8.68
.....
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m default-scheduler Successfully assigned nginx-5796d5bc7c-xsl6p to ip-10-10-8-68.eu-west-1.compute.internal
Normal SuccessfulMountVolume 2m kubelet, ip-10-10-8-68.eu-west-1.compute.internal MountVolume.SetUp succeeded for volume "config"
Normal SuccessfulMountVolume 2m kubelet, ip-10-10-8-68.eu-west-1.compute.internal MountVolume.SetUp succeeded for volume "default-token-cccxn"
Normal Pulled 1m (x3 over 2m) kubelet, ip-10-10-8-68.eu-west-1.compute.internal Successfully pulled image "myapp"
Normal Created 1m (x3 over 2m) kubelet, ip-10-10-8-68.eu-west-1.compute.internal Created container
Normal Started 1m (x3 over 2m) kubelet, ip-10-10-8-68.eu-west-1.compute.internal Started container
Warning BackOff 1m (x5 over 1m) kubelet, ip-10-10-8-68.eu-west-1.compute.internal Back-off restarting failed container
Warning FailedSync 1m (x5 over 1m) kubelet, ip-10-10-8-68.eu-west-1.compute.internal Error syncing pod
Normal Pulling 57s (x4 over 2m) kubelet, ip-10-10-8-68.eu-west-1.compute.internal pulling image "myapp"
Look at the messages of the output, here you can find the reason of the error!
No comments:
Post a Comment