KubeGlanceDownload
CrashLoopBackOff delay is per-node kubelet config now: maxContainerRestartPeriod, measured

concepts

CrashLoopBackOff delay is per-node kubelet config now: maxContainerRestartPeriod, measured

back-off 5m0s restarting failed container on one node, 20s on another? Since 1.35 the cap is kubelet config: crashLoopBackOff.maxContainerRestartPeriod.

· 11 min read

The wait between restarts of a crash-looping container is decided by the kubelet on the node the Pod runs on, from that kubelet’s own configuration. Since Kubernetes 1.35 the ceiling is a kubelet setting, crashLoopBackOff.maxContainerRestartPeriod, anywhere from 1s to 300s. So the same broken Pod can retry every five minutes on one node and every twenty seconds on the next, and nothing in the Pod spec shows it.

Here is one Pod, created on two nodes of the same 1.37.0 cluster at the same moment, six minutes later. One kubelet has the default configuration. The other has maxContainerRestartPeriod: "20s":

kubectl get pods -n k16-backoff -o wide
NAME             READY   STATUS   RESTARTS        AGE     IP           NODE                        NOMINATED NODE   READINESS GATES
crasher-cp       0/1     Error    6 (3m26s ago)   6m23s   10.244.0.7   glance-k137-control-plane   <none>           <none>
crasher-worker   0/1     Error    16 (24s ago)    6m23s   10.244.1.2   glance-k137-worker          <none>           <none>

Same image, same command, six restarts against sixteen. Neither shows CrashLoopBackOff, which is its own surprise, covered below.

The CrashLoopBackOff troubleshooting guide already notes that five minutes is only a default. This article is about the machinery: where the kubelet keeps the backoff, what resets it, and how to read the number a given node is actually using.

The fastest check

Two questions: what delay is this container on right now, and what ceiling does its node allow. The first is on the Pod, in the waiting message the kubelet writes:

kubectl get pods -n k16-backoff -o custom-columns='POD:.metadata.name,NODE:.spec.nodeName,REASON:.status.containerStatuses[0].state.waiting.reason,MESSAGE:.status.containerStatuses[0].state.waiting.message'
POD              NODE                        REASON             MESSAGE
crasher-cp       glance-k137-control-plane   CrashLoopBackOff   back-off 5m0s restarting failed container=app pod=crasher-cp_k16-backoff(48a3d992-5ccc-4a0e-9f66-a13dd1d30e67)
crasher-worker   glance-k137-worker          <none>             <none>

back-off 5m0s is the delay the kubelet is currently enforcing for that container. The empty row is not a mistake: the message only exists while the Pod is showing the waiting state, and for most of each backoff window it is not. More on that below.

The second question is answered by the node itself. The kubelet serves its running configuration on /configz, and the API server proxies to it:

for n in $(kubectl get nodes -o name); do
  printf '%s\t' "${n#node/}"
  kubectl get --raw "/api/v1/nodes/${n#node/}/proxy/configz" | jq -r '.kubeletconfig.crashLoopBackOff.maxContainerRestartPeriod'
done
glance-k137-control-plane	5m0s
glance-k137-worker	20s
glance-k137-worker2	5m0s

This is the effective value after the config file, drop-ins and flags have been merged, which is the only one that matters. It needs get on nodes/proxy, a powerful permission that many read-only roles rightly do not have. If you cannot call it, the kubelet’s own log is the fallback: since 1.37 it prints its whole effective configuration at start-up (kubernetes/kubernetes#139837):

Sep 30 08:03:35 glance-k137-worker kubelet[4793]: I0930 08:03:35.796133    4793 server.go:257] "Effective KubeletConfiguration" config=<
Sep 30 08:03:35 glance-k137-worker kubelet[4793]:         crashLoopBackOff:
Sep 30 08:03:35 glance-k137-worker kubelet[4793]:           maxContainerRestartPeriod: 20s

Everything in this article was run on a kind cluster on Kubernetes 1.37.0, and the source references are to release-1.37 unless stated otherwise.

The measurement

The Pod is as small as a crash loop gets: busybox:1.37 running sh -c 'echo starting; exit 1', pinned with a nodeSelector. Both copies were created at 07:45:43 UTC. The worker’s kubelet had one change in /var/lib/kubelet/config.yaml:

crashLoopBackOff:
  maxContainerRestartPeriod: "20s"

Every status change was recorded with kubectl get pods -w. The gap is the container’s startedAt minus the previous run’s finishedAt, both from the Pod status, so it has one-second resolution. The delay column is the kubelet’s own back-off … message for that window.

RestartDefault node: delayMeasured gap20s node: delayMeasured gap
1none1snone1s
210s10s10s14s
320s25s20s26s
440s46s20s25s
51m20s87s20s30s
62m40s163s20s21s
75m0s319s20s28s
85m0s319s20s23s
9–1620s22s to 30s
The two Pods are identical until the second minute. After that, the node decides.

Three things in that table are not in most descriptions of the backoff.

The first restart has no delay. Both nodes restarted the container one second after it first died. The familiar “10s, 20s, 40s” starts from the second restart.

The measured gap is never shorter than the delay, and up to half again longer. Twenty-second delays produced gaps from 21s to 30s. Five-minute delays produced 319s. That is not noise; it is a deliberate jitter in the kubelet’s pod worker, explained in the next section.

Neither Pod says CrashLoopBackOff most of the time. Both show Error, the reason on the terminated container, for most of each window.

The edge case below the initial delay behaves as the docs say. With the maximum at "2s" (set through a drop-in file, see below), every retry after the first landed three seconds after the previous exit, 46 times in a row, with the kubelet reporting back-off 2s each time. There is no 10s step at all.

Where the kubelet builds the backoff

The whole mechanism is one in-memory map inside the kubelet process.

The delay lives in the kubelet's memory, keyed by the Pod's UID and the container's image and resources. The API server only ever sees its effects.

Building it. When the kubelet starts, newCrashLoopBackOff (pkg/kubelet/kubelet.go lines 353–369) picks two numbers. It starts from an initial delay of 10s and a maximum of 300s (lines 166 and 173). If the alpha gate ReduceDefaultCrashLoopBackOffDecay is on, those become 1s and 60s. Then, if KubeletCrashLoopBackOffMax is on, the maximum is replaced by the configured maxContainerRestartPeriod, and if that is below the initial delay the initial delay is lowered to match. The result goes into a client-go flowcontrol.Backoff at line 1087.

Doubling it. Backoff.Next (staging/src/k8s.io/client-go/util/flowcontrol/backoff.go lines 96–109) creates an entry at the initial delay the first time it sees a key, and doubles it on every later call, clamped with min(delay, p.maxDuration). The kubelet creates this Backoff without jitter.

Checking it. Before starting any container, doBackOff (pkg/kubelet/kuberuntime/kuberuntime_manager.go lines 2077–2109) takes the exit time of the container’s last run and asks IsInBackOffSince. With no entry the answer is no: the kubelet calls Next, which creates the entry at the initial delay, and starts the container immediately. That is the undelayed first restart. On later exits there is an entry, and if its delay has not elapsed since the exit the kubelet emits the event and returns an error carrying the exact expiry time.

Waiting for it. Since 1.35 the pod worker requeues the Pod for that expiry instead of a fixed retry period (kubernetes/kubernetes#133066, fixing #123602). In pkg/kubelet/pod_workers.go lines 1535–1547 the wait is capped at the kubelet’s syncFrequency (default one minute) and passed through wait.Jitter with a factor of 0.5 (line 330), which returns somewhere between the delay and one and a half times it. That is the 21s to 30s spread in the table, and the reason a five-minute delay became 319s: the kubelet wakes every 60 to 90 seconds to re-check, and the final leg is jittered too. On release-1.34 the same branch requeued after the pod worker’s own fixed 10s error period plus jitter (line 1523), whatever the backoff was.

Resetting it. The docs say the backoff resets once a container has run for 10 minutes. In the code this is not tied to the maximum at all. The kubelet replaces client-go’s default expiry rule (twice the maximum) with a fixed one at kubelet.go lines 1088–1090:

klet.crashLoopBackOff.HasExpiredFunc = func(eventTime time.Time, lastUpdate time.Time, maxDuration time.Duration) bool {
	return eventTime.Sub(lastUpdate) > 600*time.Second
}

lastUpdate is when the kubelet last called Next, which is the moment it restarted the container. eventTime is the container’s next exit. So a container that stays up for more than 600 seconds after a restart finds its entry expired when it next dies: it restarts immediately, and the following delay starts again at the initial value (from the code; a ten-minute run was not part of the test). Housekeeping also deletes entries not touched for 600 seconds (Backoff.GC, called from HandlePodCleanups at kubelet_pods.go line 1485). A node with maxContainerRestartPeriod: "20s" still needs ten minutes of uptime to forget a crash loop; a crash every five minutes keeps it pinned at 20s indefinitely.

What survives, and what gives you a fresh backoff

The entry is looked up by GetBackoffKey (pkg/kubelet/kuberuntime/helpers.go lines 193–207), an FNV hash of:

key := []string{
	pod.Name,
	pod.Namespace,
	string(pod.UID),
	container.Name,
	container.Image,
	container.Resources.String(),
}

Three consequences follow, two of them tested here.

  • A new Pod starts clean. A Pod recreated by its controller after a delete, a Deployment rollout, an eviction or a reschedule has a new UID, so there is no entry to find. Moving to another node does not carry the backoff either; the other kubelet has never seen the key.
  • Changing the image string resets it. In the middle of a back-off 2m40s window, 35 seconds in, we ran kubectl set image pod/crasher-worker app=docker.io/library/busybox:1.37. That is the same image under its fully qualified name. The container restarted three seconds later, and the next delay was back-off 10s. The same applies to container.Resources, so an in-place resize of a crash-looping container should start it on a fresh backoff too (from the key, not tested here).
  • Restarting the kubelet resets every container on the node. The map is never persisted. We restarted the worker’s kubelet while the Pod was in its 20s rhythm: the container started within a second, then waited 10s, then 20s. Any kubelet restart, including a config change like the one in this article, gives every crash-looping container on that node one free, immediate retry.

What the Pod itself cannot do is set the delay: the Pod spec has no field for it. In 1.37 the Pod API can decide whether a container restarts, with container-level restartPolicy and restartPolicyRules (ContainerRestartRules, beta and on by default since 1.35, pkg/features/kube_features.go lines 1438–1441), but not when. Every container start, rule or no rule, goes through the same doBackOff call (line 1818). The pod lifecycle docs say the same: “The container restarts will follow the same exponential backoff as pod restart policy”.

Why the Pod says Error instead of CrashLoopBackOff

CrashLoopBackOff is not a state the kubelet enters. It is a waiting reason it reports, and it reports it one sync late. When a container exits, the kubelet’s next sync builds the Pod status first and only then decides to back off. The CrashLoopBackOff reason is written into the kubelet’s reason cache after that sync (kubelet.go line 2268) and is only turned into a waiting state by the next status build (kubelet_pods.go lines 2765–2790).

On release-1.34 the pod worker retried a backed-off Pod every 10 to 15 seconds, so from the source the waiting state should have appeared within that (not re-measured here). Since 1.35 the kubelet sleeps until the delay has passed, or until its one-minute resync. In the recording:

  • On the default node, in a five-minute window, the Pod showed Error for the first 87 seconds and CrashLoopBackOff for the rest.
  • On the 20s node, after the first window, CrashLoopBackOff appeared only in the same second as each restart. For practical purposes that Pod never showed it.

So a short maxContainerRestartPeriod turns a Pod that everyone would recognise as crash-looping into one whose STATUS column reads Error with a climbing restart count. With no waiting reason, kubectl prints the terminated container’s reason, as covered in how kubectl builds the STATUS column. The RESTARTS bracket is affected too: while the container is terminated, lastState holds the run before it, which is why the default-node Pod above said 6 (3m26s ago) when its latest crash was 40 seconds old. The RESTARTS column article covers what that bracket normally means.

What the events show

kubectl describe pod on the 20s node, a few minutes in:

Events:
  Type     Reason     Age                  From               Message
  ----     ------     ----                 ----               -------
  Normal   Scheduled  3m35s                default-scheduler  Successfully assigned k16-backoff/crasher-worker to glance-k137-worker
  Normal   Pulling    3m35s                kubelet            spec.containers{app}: Pulling image "busybox:1.37"
  Normal   Pulled     3m26s                kubelet            spec.containers{app}: Successfully pulled image "busybox:1.37" in 8.805s (8.805s including waiting). Image size: 1911395 bytes.
  Normal   Created    61s (x8 over 3m26s)  kubelet            spec.containers{app}: Container created
  Normal   Started    61s (x8 over 3m26s)  kubelet            spec.containers{app}: Container started
  Normal   Pulled     61s (x7 over 3m25s)  kubelet            spec.containers{app}: Container image "busybox:1.37" already present on machine and can be accessed by the pod
  Warning  BackOff    9s (x10 over 3m24s)  kubelet            spec.containers{app}: Back-off restarting failed container app in pod crasher-worker_k16-backoff(203f7ba6-7900-486e-9413-b370d9f9eed7)

The event text is fixed at kuberuntime_manager.go line 2099: Back-off restarting failed container %s in pod %s. It never includes the delay, so it looks identical on a 2s node and a 300s node. Two things make its count misleading:

  • It counts backoff checks, not restarts. The kubelet emits it on every sync that finds the container still backing off, including the 60 to 90 second wake-ups. On the default node the BackOff event had a count of 12 on a Pod that had restarted six times.
  • It starts over when the kubelet restarts. After each kubelet restart the worker Pod gained a fresh BackOff event object with its own count, rather than one growing series.

For the delay, read the waiting message. For the history, read the restart count and lastState.

Setting it: config file, drop-in, flags

maxContainerRestartPeriod has no command-line flag; it exists only in KubeletConfiguration. The kubelet assembles that configuration at start-up in cmd/kubelet/app/server.go lines 216–243, in this order, later winning:

  1. Built-in defaults. With KubeletCrashLoopBackOffMax on, an unset value is defaulted to 300s (pkg/kubelet/apis/config/v1beta1/defaults.go lines 310–314). That is why this kind node’s crashLoopBackOff: {} reports 5m0s.
  2. The --config file.
  3. Every .conf file in --config-dir, in lexical order, each replacing the fields it sets. The drop-in directory is GA since 1.35 (KEP-3983), but there is no default path; it only applies if the flag is set.
  4. Command-line flags.

We checked the drop-in precedence directly. With "20s" still in config.yaml, adding --config-dir=/etc/kubernetes/kubelet.conf.d and this file:

# /etc/kubernetes/kubelet.conf.d/50-crashloop.conf
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
crashLoopBackOff:
  maxContainerRestartPeriod: "2s"

made configz report {"maxContainerRestartPeriod":"2s"}, and that run produced the three-second retries above. If a node disagrees with the file you are reading, look for a drop-in.

Validation is strict (pkg/kubelet/apis/config/validation/validation.go lines 250–259). Outside 1s–300s the kubelet does not clamp the value, it refuses to start:

E0930 07:53:29.421913    1932 run.go:72] "command failed" err="failed to validate kubelet configuration, error: invalid configuration: CrashLoopBackOff.MaxContainerRestartPeriod (got: 600 seconds) must be set between 1s and 300s, path: &TypeMeta{Kind:,APIVersion:,}"

That was "600s", and the node would have gone NotReady if it had been left in place. You cannot use this setting to make crash loops slower than the default. If you turn KubeletCrashLoopBackOffMax off, setting the field at all becomes a validation error.

The alpha gate does less than the docs say

The docs describe ReduceDefaultCrashLoopBackOffDecay as lowering the cluster defaults to a 1s start and a 60s cap. On 1.35 and later that is only half true. newCrashLoopBackOff applies the reduced numbers first, then lets KubeletCrashLoopBackOffMax, on by default, overwrite the maximum with the configured value. That value is always set, because defaulting filled in 300s. So enabling the alpha gate alone gives a 1s start and the usual 300s cap.

Measured on the worker with only featureGates: {ReduceDefaultCrashLoopBackOffDecay: true} added:

Restart23456789
Kubelet delay1s2s4s8s16s32s1m4s2m8s
Measured gap2s3s5s10s22s44s77s141s

2m8s is past any 60s cap. To get the behaviour the docs describe, set maxContainerRestartPeriod: "60s" explicitly alongside the gate.

What per-node delays do to an incident

The setting is per kubelet, so it follows however your nodes are built: per node pool, per machine image, or whatever a managed provider’s node configuration exposes. Two node pools configured by different people are the normal way to end up with a mixed cluster.

In an incident, a Deployment whose replicas landed on both kinds of node looks inconsistent:

  • Restart counts diverge. Replicas of the same bad release sit at 6 and 16 after six minutes and drift further apart from there. It reads like a node-specific fault when it is a node-specific setting.
  • Your fix shows up at different times. On a 300s node the first retry after a config fix can be five minutes out; on a 20s node it is under half a minute. Only a new Pod (new UID, no entry) or a kubelet restart on that node skips the wait.
  • Load on dependencies differs. Every restart is a fresh connection storm to the database or the config service. Once both have reached their ceiling, a 2s node retries about a hundred times as often as a 300s node: every 3s against every 319s in the measurements above.
  • Alerts on STATUS miss the fast nodes. As shown above, a Pod on a node with a short ceiling rarely shows CrashLoopBackOff at all.

Where this is heading upstream

maxContainerRestartPeriod came from KEP-4603, Tune CrashLoopBackOff, alpha in 1.32. In October 2025 the configurable maximum was split out as KEP-5593 so it could graduate on its own, and went beta, on by default, in 1.35. Its tracking issue was closed as not planned by the stale-issue bot on 20 June 2026, after the assignee said in January there was no bandwidth to take it to GA in 1.36. In release-1.37 the gate is still beta (kube_features.go lines 1754–1757). KEP-4603 itself, which carries the reduced 1s/60s defaults, is open but stale, and ReduceDefaultCrashLoopBackOffDecay is still alpha and off in 1.37 (lines 2044–2046). The field works and is on by default; it is still a beta API, so its name and range could in principle change before GA.

Doing it on purpose

  • Pick one value per cluster and write it down. If you lower it, 60s to 120s gets a fixed deployment back noticeably faster without hammering dependencies; the default 300s is still right where retries are expensive.
  • Put it in the node pool’s kubelet config, not on individual nodes. A hand-edited node is exactly the node that disagrees with everyone else during an incident.
  • Add the configz loop to your runbook. It is the most direct way to see the effective number, and it takes a second.

All pod status errors, with the fix for each: Kubernetes pod status errors.

When one replica is restarting three times as often as its siblings, the node is the first thing to check. KubeGlance is a native Kubernetes client for iPhone and iPad, with a full Mac app on the same core — restarts and the node for every pod in one list, and the last termination reason a tap away.

Get KubeGlance
#crashloopbackoff #kubelet #kubelet-config #pods #restarts

The Kubernetes dashboard that fits in your pocket

KubeGlance is a native Kubernetes client for iPhone and iPad — the real dashboard, not a companion — with a full Mac app on the same core. Pods, workloads, logs and events, straight from your kubeconfig.

Download KubeGlance

Choosing a Kubernetes client? Compare KubeGlance with Lens, k9s, Headlamp and Aptakube, or see the Mac and iPhone options.