kubectl get pods shows a STATUS for each Pod. Learn to read it before you touch anything.
The phases
Every Pod has a phase in status.phase. There are only four that matter:
| Phase | Meaning |
|---|---|
Pending | Accepted, but not every container is running yet |
Running | At least one container is running |
Succeeded | Every container finished with exit code 0 |
Failed | Every container stopped, and at least one failed |
The STATUS column says more
The column shows the phase, or something more exact when there is more to say:
| STATUS | Means | Good or bad |
|---|---|---|
ContainerCreating | The image is being pulled and the container started | Normal for a few seconds |
Running | Up | Good |
Completed | The command finished with exit code 0 | Good, for one-off work |
Error | The command finished with another exit code | Bad |
ErrImagePull, ImagePullBackOff | The image cannot be downloaded | Bad: name or tag |
CrashLoopBackOff | The container starts, stops, and is started again, with a growing wait | Bad: the program fails |
BackOff means Kubernetes retries, and waits longer each time: 10 seconds, 20, 40, up to 5 minutes.
RESTARTS
The RESTARTS column counts how often the container was started again inside the same Pod. Running with RESTARTS 14 is a Pod that keeps dying. Zero is what you want.
learner@shallows:~$ kubectl get pods
NAME READY STATUS RESTARTS AGE
shop-web 1/1 Running 0 2m
shop-api 0/1 CrashLoopBackOff 4 (30s ago) 2m
shop-cache 0/1 ImagePullBackOff 0 2m
shop-import 0/1 Completed 0 2mREADY 0/1 means the Pod has one container and it is not ready to serve. The next two lessons show how to find out why.