Skip to content

Pods and the kubelet

What CrashLoopBackOff is counting

Not a state the pod is in. A delay the kubelet is imposing, doubling, between restarts of a container that keeps exiting.

about 9 minutes

The pod has not failed

A pod in CrashLoopBackOff has a phase of Running. That is not a quirk — it is the truth. The pod exists, it is scheduled, it is assigned, and the kubelet is going to try again. Nothing has given up.

What CrashLoopBackOff names is the wait. The container exited, the kubelet restarted it, it exited again, and the kubelet is now waiting before the next attempt — ten seconds, then twenty, then forty, doubling up to a cap. The restartCount is how many times it has tried. The lastState.terminated is why the last attempt ended, and it is the field with the answer in it: an exit code of 1 is your application refusing to start, and a 137 is something killing it.

The backoff is why a crash loop gets quieter over time rather than louder. An application that has been failing for an hour is retrying every five minutes, so the logs go quiet exactly when the problem is most established.

Try this
apiVersion: apps/v1
kind: Deployment
metadata:
  name: worker
spec:
  replicas: 1
  selector:
    matchLabels:
      app: worker
  template:
    metadata:
      labels:
        app: worker
    spec:
      containers:
      - name: worker
        image: worker:v1
The restart count, and the reason on `lastState` rather than on `state`.
0ms simulated

Pods — in creation order

No pods. Nothing has been asked for, or nothing has acted yet.

Events — in the order the cluster produced them

No events yet.

Everything you do here stays in this browser.Part of liter8.sh