Kubernetes CrashLoopBackOff Troubleshooting: A Step-by-Step Debugging Workflow
KubernetescontainerstroubleshootingkubectlDevOps

Kubernetes CrashLoopBackOff Troubleshooting: A Step-by-Step Debugging Workflow

ddetails.cloud Editorial Team
2026-11-30
7 min read

A practical Kubernetes CrashLoopBackOff workflow covering logs, events, probes, configuration, exit codes, and recurring review checkpoints.

Kubernetes reports CrashLoopBackOff when a container starts, exits, and is repeatedly restarted with an increasing delay between attempts. This guide provides a repeatable troubleshooting workflow: inspect pod status and events, collect current and previous-container logs, verify probes and configuration, interpret exit codes, and record recurring signals so the next incident is faster to diagnose.

Overview

CrashLoopBackOff is a status condition, not a single root cause. It means the kubelet is backing off before restarting a container that has failed repeatedly. The application may be exiting on its own, being terminated by a probe, running out of memory, failing to load configuration, or encountering an environment-specific dependency problem.

Start by identifying the affected workload and namespace:

kubectl get pods -n <namespace>
kubectl get pod <pod-name> -n <namespace> -o wide

Use the pod details to determine which container is failing. A pod can contain multiple containers, and the status of one container may be hidden by a quick glance at the overall pod status. For a broader view, inspect the owning workload and its recent rollout:

kubectl describe pod <pod-name> -n <namespace>
kubectl get deployment <deployment-name> -n <namespace> -o yaml
kubectl rollout status deployment/<deployment-name> -n <namespace>

Do not delete the pod before collecting evidence unless the immediate operational response requires it. Restarting it can remove the most useful clues, especially when the container produces only a short burst of output before exiting.

What to track

1. Pod events and container state

Run kubectl describe pod and read the Events section from the bottom upward. Events may show failed mounts, image pull problems, probe failures, scheduling issues, or messages associated with restarts. The container status also exposes the last termination reason, exit code, start time, and finish time.

kubectl get pod <pod-name> -n <namespace> \
  -o jsonpath='{range .status.containerStatuses[*]}{.name}{"\n  state="}{.state}{"\n  last="}{.lastState}{"\n  restarts="}{.restartCount}{"\n"}{end}'

For a clean record during an incident, note the container name, restart count, termination reason, exit code, and timestamps. These values help distinguish a new failure from an older restart that is still visible in the pod status.

2. Current and previous-container logs

Read the current log first, then request logs from the previous container instance. The previous instance is often the most valuable source when the application exits quickly.

kubectl logs <pod-name> -n <namespace> -c <container-name>
kubectl logs <pod-name> -n <namespace> -c <container-name> --previous

If the container has multiple recent failures, add timestamps and limit the output to a manageable window:

kubectl logs <pod-name> -n <namespace> -c <container-name> \
  --previous --timestamps --tail=200

A message such as “configuration file not found,” “permission denied,” or “connection refused” points to a different investigation than a process that exits without logging. Check whether the application writes errors to standard error, whether a sidecar owns the relevant logs, and whether the logging configuration changed in the same deployment.

3. Exit codes and termination reasons

The exit code is a clue, not a complete diagnosis. A zero exit code can still produce a restart loop if the container is intended to run continuously but its main process finishes. A nonzero code usually indicates an application or startup failure. A termination reason such as OOMKilled points toward memory pressure or a container memory limit rather than an ordinary application exception.

Compare the exit code with the termination signal, application logs, and resource configuration. Review Kubernetes resource requests and limits when memory-related termination is suspected, and check whether a recent change altered the container limit or startup workload.

4. Probes and startup timing

Inspect liveness, readiness, and startup probes in the workload specification:

kubectl get deployment <deployment-name> -n <namespace> -o yaml

A liveness probe can restart a running container when its check fails repeatedly. A startup probe, when configured, can give a slow-starting application additional time before liveness checking begins. Readiness failures normally remove a pod from service without restarting it, but probe configuration should still be checked because similar paths and ports can be misconfigured.

Verify the probe path, port, scheme, command, initial delay, period, timeout, and failure threshold. Test the endpoint from inside the pod or with an appropriate ephemeral debugging method when available. Avoid “fixing” a probe by simply making it less strict; first establish whether the application is healthy but slow, or unhealthy because it cannot complete initialization.

5. Configuration, secrets, images, and dependencies

Compare the failing pod specification with the last known-good revision. Check environment variables, ConfigMap references, Secret references, mounted files, working directory, command, arguments, image tag, and service-account permissions. A missing key or incorrectly named mount can cause an immediate process exit.

Inspect the rendered workload rather than only the source manifest. Templating, overlays, admission changes, or deployment variables may produce a different runtime configuration. If the application depends on a database, queue, DNS name, certificate, or external API during startup, verify that dependency from the cluster context. NetworkPolicy changes can alter reachability; use the Kubernetes NetworkPolicy connectivity guide when policy is part of the change.

Cadence and checkpoints

Use the workflow during every restart incident, then maintain a small recurring review of the signals that reveal repeat failures:

  • Per incident: capture pod description, events, current logs, previous-container logs, restart count, exit code, and the deployed image digest or release identifier.
  • After each rollout: verify that the deployment reaches its expected availability, check restart counts, and review whether new warnings appeared in startup logs.
  • Monthly or quarterly: review workloads with repeated restarts, probe failures, OOMKilled events, slow initialization, and manual rollback activity. Prioritize patterns rather than isolated restarts.
  • Before platform or Kubernetes upgrades: test representative workloads, validate deprecated configuration, and confirm that health checks, security contexts, volume mounts, and admission controls still behave as expected. The Kubernetes upgrade readiness checklist can structure this review.

Keep incident notes close to the workload or service record. A short table containing date, release, exit code, termination reason, probe result, and confirmed cause is more useful than an unstructured collection of terminal output.

How to interpret changes

Observed symptomLikely directionNext check
Previous logs show a configuration or parsing errorInvalid or missing runtime inputCompare ConfigMaps, Secrets, environment variables, arguments, and mounted files with the last working revision.
Exit code is zero and the process ends quicklyMain process completed unexpectedlyVerify the image entrypoint, command, arguments, and whether the container is meant to run as a long-lived service.
Termination reason is OOMKilledMemory use reached the container limitReview limits, requests, workload behavior during startup, and application memory settings.
Events report repeated liveness probe failuresHealth check or application startup problemCheck endpoint, port, timing, authentication expectations, and startup duration before changing thresholds.
Logs are empty and the pod never reaches runningFailure may occur before application startupInspect events, image pull status, mounts, security context, command, and admission-related changes.
Restarts began immediately after a rolloutRelease or rendered configuration regressionCompare revisions and consider a controlled rollback while preserving evidence.

Look for correlation before changing multiple variables. If only one deployment revision has the problem, compare that revision first. If several unrelated workloads restart on the same nodes or at the same time, broaden the investigation to node conditions, shared dependencies, cluster capacity, and platform changes.

When to revisit

Revisit this workflow whenever a deployment repeatedly restarts, a new probe is introduced, the image or entrypoint changes, configuration or secrets are rotated, resource limits are adjusted, or a production rollout fails. It is also worth reviewing on a monthly or quarterly cadence to find workloads that recover before anyone opens an incident.

For the next review, select a representative set of services and record their restart count, recent termination reasons, probe failures, startup duration, and resource-related events. Compare those observations with the previous review rather than relying on a single snapshot. An increase in restarts after a release suggests a change-related regression; a gradual increase in startup time may indicate resource pressure, dependency latency, or application growth.

When an incident occurs, use this compact sequence:

  1. Identify the namespace, pod, and failing container.
  2. Run kubectl describe pod and preserve events.
  3. Collect current and --previous logs.
  4. Record exit code, termination reason, timestamps, and restart count.
  5. Inspect probes, commands, arguments, configuration, secrets, mounts, resources, and dependencies.
  6. Compare the current revision with the last known-good revision.
  7. Apply one controlled change, observe the result, and document the confirmed cause.

This turns CrashLoopBackOff from a vague pod status into a trackable operational signal. The goal is not merely to stop the restarts, but to identify why the container failed and make the evidence available for the next rollout, upgrade, or incident review.

Related Topics

#Kubernetes#containers#troubleshooting#kubectl#DevOps
d

details.cloud Editorial Team

Cloud-native engineering editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.