Pods: phases, probes, and graceful termination

Pending is scheduling, ContainerCreating is the kubelet, CrashLoopBackOff is your process. Probes decide traffic and restarts — and terminating gracefully is something you have to code.

Read the briefing
About 9 min to read 8 drills

What to remember

  1. The phase names the layer at fault. Pending = scheduler, ContainerCreating = image or volume, CrashLoop = the process itself.
  2. Liveness restarts, readiness routes. A liveness probe that checks a dependency turns a downstream blip into a restart storm.
  3. Startup probes exist so slow starters are not killed. Use them instead of loosening liveness thresholds forever.
  4. SIGTERM, grace period, then SIGKILL. Handle SIGTERM, drain, exit. A pod that always takes the full grace period is ignoring it.
  5. preStop plus readiness false is what makes deploys invisible. Endpoint removal and SIGTERM race; the sleep is what covers the gap.

The big picture

A pod's lifecycle is the sequence every workload goes through: scheduled, init containers run in order, app containers start, probes decide whether it gets traffic and whether it is restarted, and on deletion it is drained and stopped under a grace period. Interviewers test it because almost every "it works on my machine but not in the cluster" story is a lifecycle story: a liveness probe killing a slow starter, 502s from a termination race, a CrashLoopBackOff nobody read the exit code of. Knowing which mechanism owns which symptom is the skill.

The mental model

Think of the pod as a small state machine with two independent watchers. The kubelet owns the containers: it starts them in order, restarts them under restartPolicy, kills them on liveness failure, and stops them on deletion with SIGTERM then SIGKILL. The endpoint machinery owns traffic: readiness decides whether the pod is listed, and that list propagates to kube-proxy and ingresses a little later than the kubelet acts. Most lifecycle bugs are one watcher being told something the other has not caught up with yet.

In depth

Phases, container states, and what STATUS really shows

status.phase is a five-word summary of the whole pod: Pending (accepted, but not all containers are running: unscheduled, pulling images, or still in init), Running (bound to a node, at least one container running or restarting), Succeeded (every container exited 0 and will not restart), Failed (every container terminated, at least one non-zero, no restart), Unknown (the kubelet has stopped reporting, usually a node problem). Note what Running does not say: a pod in CrashLoopBackOff is usually phase Running, and a pod that is Running may be 0/1 READY.

The detail lives one level down. status.containerStatuses[] gives each container a state of Waiting (with a reason such as ContainerCreating, CrashLoopBackOff, ImagePullBackOff, CreateContainerConfigError), Running (with startedAt), or Terminated (with exitCode, a reason such as Completed, Error, or OOMKilled, and finishedAt), plus a lastState holding the previous termination and a restartCount. Exit codes follow the shell convention: 0 success, 1 or 2 application error, 128 + signal for a signal death, so 137 is SIGKILL (the OOM killer, or the kubelet after the grace period) and 143 is SIGTERM.

The STATUS column of kubectl get pods is a synthesized string, not a field: it prefers the Waiting reason of a container, shows Init:1/2 or Init:CrashLoopBackOff while init containers run, Terminating once a deletionTimestamp is set, Completed for Succeeded, and Evicted when the kubelet reclaimed the node. Read it as a hint, then confirm with kubectl describe pod (Last State, Events) or kubectl get pod -o yaml. Pod conditions (PodScheduled, Initialized, ContainersReady, Ready) tell you which stage of the lifecycle the pod has reached, and their lastTransitionTime tells you when it got stuck.

Init containers and start order

Init containers are ordinary containers listed under spec.initContainers, with two rules: they run one at a time, in order, and each must exit 0 before the next starts. App containers are not created until the last init container has succeeded. If an init container fails, the kubelet restarts it under the pod's restartPolicy (with Never, the whole pod fails), and the STATUS column shows Init:Error then Init:CrashLoopBackOff; the RESTARTS column counts those init restarts even though no app container has ever run. Init:1/2 means the first has finished and the second is running.

They exist for work that must happen before the app can start and that should not live in the app image: waiting for a dependency to accept connections, fetching a config bundle, running a schema check, fixing ownership on a volume. Resource accounting is the detail interviewers probe: the pod's effective request for scheduling is the larger of the highest init container request and the sum of the app container requests, because init containers do not run alongside the app.

Two pitfalls. The until nc -z db 5432; do sleep 2; done wait loop is fine, but the script must exit 0 on success; an exit 1 after the loop, or set -e with a command that fails, makes the pod loop forever in init with the dependency perfectly healthy. And an init container that waits with no timeout hides the real failure (DNS, a NetworkPolicy, a wrong port) behind an endless Init:0/1; put a bound on the wait and log what it is waiting for. Sidecar containers are the related concept: an init container with restartPolicy: Always starts in order like an init container but keeps running beside the app and is stopped after it, which is how log shippers and proxies get a deterministic start order.

The three probes and their different jobs

Each probe answers a different question and triggers a different action. Readiness: should this pod receive traffic? While it fails, the pod is Ready=False and is removed from its Service's EndpointSlices; nothing is restarted. Liveness: should this container be restarted? After failureThreshold consecutive failures the kubelet kills the container and applies the restart policy. Startup: has the application finished starting? While a startup probe is defined and has not yet succeeded, liveness and readiness are not run at all, which lets you keep a tight liveness probe for the steady state without killing a slow starter.

The parameters are the same for all three: initialDelaySeconds (default 0), periodSeconds (10), timeoutSeconds (1), successThreshold (1), failureThreshold (3), and the handler is httpGet, tcpSocket, exec, or grpc. Detection time is roughly period times failureThreshold, so the defaults notice a dead container in about 30 seconds. A JVM that boots in 60 seconds with liveness at initialDelaySeconds: 10, periodSeconds: 10, failureThreshold: 3 is killed at second 40 every time; the fix is startupProbe: { failureThreshold: 30, periodSeconds: 10 }, not a longer initial delay.

Failure modes that page you. A liveness probe that checks a dependency (database, downstream API) converts that dependency's outage into a restart storm of perfectly healthy processes; liveness should test only that the process is alive and not deadlocked. timeoutSeconds: 1 on an endpoint that takes 1.5 seconds under load, or failureThreshold: 1, restarts pods precisely when you can least afford it. Using one /healthz for both readiness and liveness means every readiness failure is also a restart. And a pod with no readiness probe is Ready the instant its containers start, so a cold JVM receives production traffic. kubectl describe pod shows Liveness probe failed: and Readiness probe failed: events with the HTTP status or error text, which is where diagnosis starts.

Termination: the sequence and the race

kubectl delete pod (or a rollout, drain, or eviction) sets metadata.deletionTimestamp and a grace period on the object; the pod shows Terminating. The kubelet then runs the container's preStop hook if one is defined, sends SIGTERM to PID 1 of each container, waits up to terminationGracePeriodSeconds (default 30) counted from the start of termination, and finally sends SIGKILL. If preStop is still running when the grace period ends, the kubelet grants a one-off two-second extension, then kills. A container that exits on SIGTERM reports exit 143 (or 0 if it handles the signal and exits cleanly); one that ignores it is killed at the deadline with exit 137 and no OOMKilled reason.

The race everyone eventually debugs: endpoint removal is concurrent, not prior. When the deletionTimestamp is set, the EndpointSlice controller marks the pod terminating and kube-proxy, the ingress controller, and any service mesh update their forwarding tables asynchronously, typically within a second or two. During that window new connections still arrive at a pod that has already received SIGTERM. An application that exits immediately on SIGTERM turns every deploy into a burst of 502s, and readiness probes cannot help because the pod is already being deleted.

The fix has three parts and they must agree: a preStop that sleeps a few seconds (exec: { command: ["sleep", "5"] }) so traffic stops arriving before the process is told to stop; an application that handles SIGTERM by closing its listener, finishing in-flight requests, and exiting; and a terminationGracePeriodSeconds larger than sleep plus drain time. A separate trap is PID 1: CMD sh -c "java -jar app.jar" makes the shell PID 1, and the shell does not forward SIGTERM, so the app never sees it and dies at the deadline. Use the exec form of CMD or an init such as tini. Pods stuck in Terminating for minutes usually have a finalizer nobody is clearing or live on a node the control plane cannot reach; kubectl delete --force --grace-period=0 removes the API object without waiting, which is safe only if you know the node will not keep running the container.

Restart policy, backoff, and what is not a restart

spec.restartPolicy is set once per pod and applies to every container in it: Always (the default, and the only value a Deployment or ReplicaSet accepts), OnFailure (restart only on non-zero exit), Never. It governs what the kubelet does with a container that has terminated, in place, on the same node, in the same pod. Each restart is delayed by an exponential backoff of 10 s, 20 s, 40 s, doubling up to a five-minute cap; while the kubelet is waiting, the container's state is Waiting with reason CrashLoopBackOff. The backoff resets once a container has run for ten minutes without exiting.

Jobs add a second layer with different vocabulary. A Job with restartPolicy: Never never restarts a container; when the pod fails the Job controller creates a new pod, and backoffLimit (default 6) caps how many failures it tolerates before marking the Job Failed, again with exponential backoff between attempts. Never keeps every failed pod around, so the logs of each attempt are available afterwards; OnFailure restarts in place, counts restarts toward the limit, and shows only the current instance unless you use kubectl logs --previous. activeDeadlineSeconds bounds the whole Job's wall-clock time regardless of retries.

What to check when something keeps restarting: kubectl describe pod for Last State (exit code and reason) and the Events (a liveness failure names itself, an OOMKill says OOMKilled, a config error says CreateContainerConfigError and never gets as far as running). Then kubectl logs --previous for the application's own last words. Three things look like restarts but are not: node-pressure eviction (the pod is marked Failed with reason Evicted and a controller makes a new one elsewhere), scheduler preemption (the pod is deleted), and a rollout (new pods, new names). Restart counts only ever describe containers inside one pod on one node.

Myths and facts

Myth: A pod in phase Running is healthy and serving.

Fact: Running only means at least one container is running or restarting. A pod in CrashLoopBackOff is usually Running; whether it serves is the Ready condition, which readiness probes control.

Myth: A failing readiness probe restarts the container.

Fact: Readiness only removes the pod from EndpointSlices. Restarts come from the liveness probe, and only after failureThreshold consecutive failures.

Myth: The pod is taken out of the Service before it receives SIGTERM.

Fact: Endpoint removal and termination start at the same time and propagate independently, so requests keep arriving for a second or two after SIGTERM. That is what preStop sleeps and graceful drain exist for.

Myth: Exit code 137 means the container was OOMKilled.

Fact: 137 is 128 + 9, SIGKILL from anyone: the OOM killer, the kubelet at the end of the grace period, or a manual kill -9. Only the Terminated reason OOMKilled confirms memory.

Myth: The liveness probe should check that the database is reachable.

Fact: Then a database outage restarts every healthy pod in a loop and slows recovery. Liveness tests that the process is alive and not deadlocked; dependency health belongs in readiness, if anywhere.

Myth: restartPolicy: Never on a Job means a failed pod is never retried.

Fact: The kubelet never restarts the container, but the Job controller creates a fresh pod for each failure up to backoffLimit. Never just means retries are new pods, which keeps every failed pod's logs.

Myth: Init containers run alongside the app containers.

Fact: They run strictly one at a time and must all succeed before any app container is created; that is why an Init: status means no application code has run yet.

How pros do it

  • Give every container behind a Service a readiness probe, and give liveness its own cheap, dependency-free endpoint; never reuse one /healthz for both.
  • Use a startupProbe for anything that takes more than a few seconds to boot, and keep liveness failureThreshold at 3 or more with timeoutSeconds sized to the endpoint's p99 under load.
  • Handle SIGTERM in the application (stop accepting, drain in-flight, exit), run it as PID 1 with the exec form of CMD or tini, and add a preStop sleep of 5 to 10 seconds.
  • Set terminationGracePeriodSeconds above preStop plus the measured drain time; the default 30 is a guess, not a measurement.
  • Bound init-container waits with a timeout and log what they wait for, so Init:0/1 never hides a DNS or NetworkPolicy problem for an hour.
  • When a pod restarts, read Last State and Events first, then kubectl logs --previous; decide which mechanism (liveness, OOM, config, application exit) owns the restart before changing anything.
  • Prefer restartPolicy: Never with a sensible backoffLimit for Jobs you will need to debug, so each attempt's pod and logs survive.

Questions people ask

Why is my pod Running but shows 0/1 READY?

Separate the two words: Running is the phase; READY counts containers whose readiness probe passes. So the container is up but not ready to serve and is out of the Service endpoints. Then say the evidence: kubectl describe pod for Readiness probe failed events and what the probe hit, connection refused versus an HTTP status.

Should the liveness probe check the database connection?

Say no and give the consequence: if the database is down, restarting your pods does not help and the restart storm makes recovery slower. Then place the check correctly: dependency health belongs in readiness if you want to stop traffic, or in metrics if you want to alert. Liveness tests only that the process is alive and not deadlocked.

Why do I get 502s during deploys when readiness probes pass?

Name the race: termination and endpoint removal start together, so for a second or two after SIGTERM the ingress still sends new requests to the pod. Then the three-part fix that must agree: a preStop sleep, drain on SIGTERM in the application, and a grace period above both. Say that readiness cannot help because the pod is already being deleted.

My container exits with 143 in one environment and 137 in another. What is the difference?

Decode both: 143 is 128 + 15, the process received SIGTERM and exited; 137 is 128 + 9, it was SIGKILLed, either by the OOM killer (reason OOMKilled) or by the kubelet because it did not exit within the grace period. Then say what 137 without OOMKilled usually means: SIGTERM never reached the process, often because a shell is PID 1.

How long does CrashLoopBackOff wait between restarts?

It doubles from 10 seconds up to a five-minute cap and resets after the container has run for ten minutes. Then add the operational point: deleting the pod resets the backoff but recreates the same failure and destroys the evidence, so read logs --previous first.

My app never sees SIGTERM and always takes exactly 30 seconds to stop. Why?

Say PID 1 is probably a shell (sh -c ...) that does not forward signals, so the app is only stopped by SIGKILL at the end of the default grace period. Then the fix: the exec form of CMD or an init such as tini. Exactly 30 seconds every time is the tell, and saying so shows you have debugged it.

The RESTARTS column keeps growing but the status is Init:CrashLoopBackOff. Which container is restarting?

The init container: app containers have not been created yet, so the count is the kubelet retrying the failing init step. Then name the command: kubectl logs -c shows why it exits non-zero. Reading the Init: prefix before anything else is the habit.

Further reading

Drills · 8

Answer in your head, or out loud, before you reveal. Mark each one: "Again" brings it back, "Got it" counts on your desk.

1 Pick the strongest answer

A pod's readiness probe has been failing for two minutes while its liveness probe keeps passing. What state is the pod in right now: is it being restarted, is it serving?

  1. The pod phase changed to Failed. Phase reflects container termination, not probe results. A not-ready pod is still Running.
  2. The kubelet restarted the container after the failure threshold. Only the liveness probe triggers restarts. Confusing the two is the most common probe error in interviews and in clusters.
  3. It is still Running and was removed from its Service's endpoints; no restart happens. Readiness controls traffic eligibility only. The container keeps running; EndpointSlices drop the pod until the probe passes again.
  4. The scheduler evicted it and is placing it on another node. Probes never move pods; scheduling happens once, at placement.
In short

The pod keeps running but is removed from the Service endpoints; a failing readiness probe never restarts a container.

Why

Readiness answers "should this pod receive traffic?"; liveness answers "should this container be restarted?". A failing readiness probe removes the pod from EndpointSlices, which is exactly what you want during warm-up or a dependency outage. A failing liveness probe restarts the container, which is what you want only for a genuinely stuck process. Interviewers listen for whether you keep these separate.

The common mistake

Saying a failing readiness probe restarts the container. Only liveness restarts; readiness only removes the pod from EndpointSlices, and the phase stays Running.

Read the docs

2 Answer out loud

Walk me through what happens between kubectl delete pod and the process exiting, and explain why in-flight requests can still fail during a rolling update even when readiness probes are configured correctly. Three to five sentences.

In short

A strong answer says the pod is removed from endpoints at the same time as SIGTERM is sent, not before, so the app must keep serving for a moment.

What a strong answer does
  • mechanism: preStop hook → SIGTERM → terminationGracePeriodSeconds → SIGKILL, and the pod is removed from EndpointSlices concurrently rather than before.
  • race: Explains that endpoint removal propagates asynchronously to kube-proxy and the ingress, so requests land on a terminating pod; names the preStop sleep plus graceful drain as the fix.
  • communication: Chronological, precise vocabulary, ends with the fix in one sentence.
Why

The key insight interviewers want is that endpoint removal and termination are concurrent, so correctness depends on the pod continuing to serve briefly after SIGTERM. Candidates who blame readiness probes reveal they have not traced the sequence.

The common mistake

Blaming readiness probes or the load balancer for the 502s. The pod is already being deleted, so readiness cannot help; the fix is to keep serving briefly after SIGTERM.

3 Pick the strongest answer

A JVM service takes about 45 seconds to boot. Its liveness probe is initialDelaySeconds: 10, periodSeconds: 10, failureThreshold: 3, and the pods restart forever without ever becoming Ready. What is going on, and what is the right fix?

  1. Set restartPolicy: Never on the Deployment's pod template. Deployments only allow restartPolicy Always, and disabling restarts would leave a dead container in place.
  2. Raise the readiness probe's timeoutSeconds so the pod is marked Ready sooner. Readiness does not restart anything; the restarts come from liveness.
  3. Increase the CPU limit so the JVM boots faster. It might shave seconds, but the probe schedule is still wrong; the fix is the probe, not the hardware.
  4. Add a startupProbe with a generous failureThreshold × periodSeconds (for example 30 × 10 s); liveness only begins once it succeeds. The startup probe exists precisely for slow-starting containers: it disables liveness and readiness checks until the app is up, without loosening liveness for the rest of the pod's life.
In short

Add a startupProbe with a long enough failureThreshold, so liveness checks only start after the app is up.

Why

Liveness starts checking at initialDelaySeconds and kills the container after failureThreshold consecutive failures: here at roughly 40 seconds, before the JVM has finished booting, every time. A startup probe gates the other two probes until it passes, so you can keep an aggressive liveness probe for the steady state. Interviewers use this to see whether you know the three probes have different jobs.

Read the docs

4 Read the output

READY says 0/2. What are the two application containers doing right now?

$ kubectl get pod api-7c9d5f6b8-2xk4p
NAME                   READY   STATUS                  RESTARTS      AGE
api-7c9d5f6b8-2xk4p    0/2     Init:CrashLoopBackOff   6 (2m ago)    9m

# pod spec (excerpt)
initContainers:
  - name: wait-for-db
    image: busybox:1.36
    command: ["sh", "-c", "until nc -z db 5432; do sleep 2; done; exit 1"]
containers:
  - name: api
    image: registry.example.com/api:2.3.1
  - name: metrics
    image: registry.example.com/metrics-sidecar:1.0
  1. Both are running but not Ready because the init container keeps restarting beside them. Init containers are sequential and precede app containers; they never run alongside them.
  2. They are running on a different node while the init container is retried here. All containers of a pod share one node and one network namespace.
  3. Neither has started: init containers must exit successfully, in order, before any app container is created. The Init: prefix means the pod is still in the init phase. READY 0/2 counts app containers that have not even been created yet.
  4. They started once, crashed, and are being restarted by the kubelet. The RESTARTS column here counts the init container's restarts.
In short

Neither app container has started, because init containers must finish successfully before any app container runs.

Why

Init containers run strictly one at a time and each must exit 0 before the next one (and eventually the app containers) starts. Here the script exits 1 by design after the loop, so the init container fails every time and the kubelet backs off. Reading the status prefix Init: tells you where in the lifecycle the pod is stuck before you look at anything else.

Read the docs

5 Find what's broken

Every deploy produces a burst of 502s at the load balancer, and pods occasionally restart under heavy load even though the service is healthy. Which lines are responsible?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
spec:
  replicas: 3
  selector:
    matchLabels: { app: api }
  template:
    metadata:
      labels: { app: api }
    spec:
      terminationGracePeriodSeconds: 2
      containers:
        - name: api
          image: registry.example.com/api:2.3.1
          ports:
            - containerPort: 8080
          readinessProbe:
            httpGet: { path: /healthz, port: 8080 }
            periodSeconds: 5
          livenessProbe:
            httpGet: { path: /healthz, port: 8080 }
            initialDelaySeconds: 2
            periodSeconds: 5
            failureThreshold: 1
In short

The 2-second grace period cuts off in-flight requests, and failureThreshold 1 restarts the container on one slow probe.

What's broken
  • Line 13: A 2-second grace period kills in-flight requests: the app receives SIGTERM and SIGKILL almost together while the endpoint removal has not propagated yet.
  • Line 26: failureThreshold: 1 restarts the container on a single slow or timed-out health check, which happens under load.
Why

Two independent lifecycle bugs. Termination: Kubernetes removes the pod from endpoints and sends SIGTERM concurrently, so for a moment requests still arrive at a pod that is shutting down; a short grace period turns that moment into dropped connections. Liveness: a threshold of one converts any transient slowness into a restart, which then causes more load on the survivors. The interview signal is separating the two mechanisms rather than blaming the load balancer.

Read the docs

6 Scenario: what do you do next?

Every rolling update of the checkout Deployment (12 replicas, maxSurge 25%, maxUnavailable 0) produces a 40-second burst of 502s at the ingress. Readiness probes are configured and pass. The app logs nothing unusual. The team has started deploying only at night.

Step 1. You have ten minutes before the next deploy. What do you look at first?

  1. Restart the ingress controller pods. Nothing points at the controller being unhealthy; this is a superstition move.
  2. Correlate the 502 timestamps from the ingress logs with pod termination events from the rollout to see whether errors cluster around pods shutting down. Cheap, fast, and it tests the leading hypothesis (termination race) with evidence before anyone changes anything.
  3. Increase replicas to 24 so there is more capacity during the deploy. Capacity is not the hypothesis; the errors happen even though readiness passes. Changing things before understanding them is what interviewers penalize.
  4. Roll back the last application release. The behaviour predates any single release and happens on every deploy; rollback addresses nothing here.

Step 2. The 502s start within one second of each old pod receiving SIGTERM and stop about ten seconds later. The app exits immediately on SIGTERM. terminationGracePeriodSeconds is 30. What do you do now?

  1. Switch the Service to sessionAffinity: ClientIP. Affinity changes which pod a client hits; it does not stop requests reaching a terminating pod.
  2. Add a preStop hook that sleeps 5–10 seconds and make the app drain in-flight requests on SIGTERM; keep the grace period above the drain time. This is the textbook fix for the endpoint-removal race: keep serving while EndpointSlices, kube-proxy, and the ingress catch up, then shut down cleanly.
  3. Set maxUnavailable to 50% so the rollout finishes faster. Faster rollouts mean more simultaneous terminations and a bigger burst.
  4. Increase the readiness probe period so pods stay Ready longer. Readiness is not the problem; the pod is already being deleted when the errors happen.

Step 3. The fix works. For the postmortem, what is the systemic change you propose?

  1. A standard pod template (preStop sleep, SIGTERM handling, grace period) enforced by a policy check in CI, plus a deploy-time SLO burn alert. A mechanism, not a reminder: every new service inherits the behaviour, and regressions are caught by policy rather than by 502s.
  2. Keep deploying at night. That hides the symptom and slows the team; the root cause remains.
  3. Document in the wiki that services should handle SIGTERM. Wiki pages are reminders; the next service will forget.
In short

Check that the 502s line up with pod termination, then add a preStop sleep and SIGTERM handling with a long enough grace period.

Why

Kubernetes tells the kubelet to stop the pod and the endpoint controller to remove it at the same time; the ingress and kube-proxy learn about the removal a little later. A process that exits instantly on SIGTERM therefore drops the requests that arrive in that window. The interview shape: evidence first, the mechanism named, a mitigation that matches the mechanism, then a systemic fix.

Read the docs

7 Quick recall

Quick one: which probe takes a pod out of the Service endpoints without restarting anything?

In short

The readiness probe removes the pod from Service endpoints without restarting the container.

Accepted

readiness · readiness probe · readinessProbe

Why

Readiness gates traffic; liveness gates restarts; startup gates the other two until the application has started.

8 Pick the strongest answer

A Job's pods run with restartPolicy: Never and the Job has backoffLimit: 3. The container exits 1. What happens next, and who retries, if anyone?

  1. The kubelet restarts the container inside the same pod with exponential backoff. That is OnFailure behaviour. Never means the pod is done once its container terminates.
  2. The Job is marked Complete because the pod terminated. Completion requires exit code 0; a non-zero exit counts as a failure.
  3. The pod is deleted immediately and the Job waits for the next schedule. Plain Jobs have no schedule (that is CronJob), and failed pods are kept for inspection until the Job is cleaned up.
  4. The pod stays in phase Failed; the Job controller creates a new pod, up to backoffLimit failures, before marking the Job failed. With Never, the kubelet does not restart the container in place; retries happen at the Job level as fresh pods.
In short

The pod stays Failed and the Job controller creates a new pod, up to backoffLimit failures.

Why

restartPolicy governs the kubelet's behaviour for containers in one pod; Jobs add their own retry layer by creating new pods. Never keeps each failed pod around so you can read its logs, which is why it is preferred for debugging batch failures; OnFailure restarts in place and can hide the history.

Read the docs

Next lesson Scheduler: filtering, scoring, and why a pod is Pending
Drill · Pods
0:00

Loading…