Cloud Computing

Kubernetes deployment stuck in CrashLoopBackOff immediately after rollout

Environment

Environment

Kubernetes cluster (managed control plane), worker nodes running kubelet 1.xx, containerd runtime. Deployment uses a single ReplicaSet, image pulled from internal registry, liveness and readiness probes configured on HTTP endpoints.

Symptoms

Symptoms

kubectl get pods shows STATUS CrashLoopBackOff for the pod; pod restarts every few seconds. The replicaSet reports desired replicas not ready, and readinessProbe prevents service traffic.

Observations

Observations

kubectl describe pod shows multiple restarts and event messages about back-off; kubectl logs -p and logs show only the container's short stdout/stderr before exit. No core dumps available on node; liveness probe failures coincide with restarts in events.

Already attempted

Already attempted

Scaled deployment down and up, removed liveness probe temporarily, redeployed with the same image tag, inspected node resource pressure (no OOM or node eviction events), checked ImagePullBackOff (image exists locally on nodes).

Diagnostic steps

Diagnostic steps

  1. kubectl logs <pod> --previous and kubectl logs <pod> to capture both the failed attempt and current logs. If logs are empty, run kubectl exec into a recreated pod or create a debug pod using the same image and start an interactive shell.
  • What the result means: If logs show an application stack trace or explicit configuration error, follow that message. If logs are empty and the container exits before stdout/stderr flush, the issue may be early process failure or PID 1 problems; an interactive shell will allow inspection of files and env.
  1. Temporarily remove or widen liveness/readiness probe (or set initialDelaySeconds to a high value) and redeploy.
  • What the result means: If pod becomes Ready after disabling/widening probes, the probe configuration is killing the container too soon — adjust path, port, timeouts, or startupProbe instead of livenessProbe for slow start.
  1. Compare Deployment environment variables, mounted ConfigMaps/Secrets and volumes with a local reproduced container (docker run or ctr run) using the same image and env values.
  • What the result means: If container runs locally with same config, cluster runtime or node permissions are implicated. If it fails locally with same error, configuration or build is at fault.
  1. Inspect node-level kubelet and container runtime logs for OOM, seccomp or AppArmor denials and check dmesg for kernel-level kills.
  • What the result means: If node logs show OOM or security denials, the container is being killed by the host—adjust resource requests/limits or security profiles. If no node errors, focus on in-container startup behavior.
  1. Deploy a debug sidecar or an ephemeral pod mounting the same volumes/ConfigMaps as the failing pod and inspect filesystem, expected sockets, and permissions.
  • What the result means: If expected files or sockets are missing or owned by wrong user, fix volume mounts or initContainers to create them. If present but inaccessible, adjust ownership or securityContext.
Confirmed fixes

Confirmed fixes

No fix has been independently verified for this scenario. Treat the causes below as diagnostic hypotheses.

Question

Question

What are the most useful diagnostics to determine why the container process exits at startup and how to make the pod remain Ready?

COMMUNITY RESPONSES

Verified community troubleshooting

1 reply
0
nathalie_net Answer
user
Posted 3w ago • 0 confirmations

Start by widening or disabling the liveness/readiness probes and redeploying to see whether the pod stabilizes; if it does, change probes to startupProbe or adjust paths/timeouts. If probes aren't the problem, run the same image locally with the exact env and mounts to reproduce the startup failure; if it runs locally the node or runtime may be killing it (check dmesg and kubelet logs). Use an interactive debug pod with identical mounts to inspect missing files or permission issues. Verify fixes by observing pods achieve Ready and stay running for several minutes under normal load.

Showing 1 of 1 community responses
AI DIAGNOSTICS

Incident analysis

Updated 3w ago• Trouble ID

Most likely causes

Application process exits due to missing configuration (missing secret or environment variable). Marked as hypothesis. 8%
Readiness/liveness probe misconfiguration (incorrect path/timeout) killing container after startup. Marked as hypothesis. 6%
Container lacks required filesystem or permission to open a needed socket/file (volume mount or permission problem). Marked as hypothesis. 5%

Summary

CrashLoopBackOff means the container process repeatedly exits and kubelet backs off restarting. Common causes include application startup errors, missing runtime configuration (secrets/ConfigMaps), misconfigured probes killing the pod, insufficient permissions or missing files, or node-level issues. Because logs show the process exits quickly, focus on capturing full startup logs, validating probe endpoints and environment variables, and reproducing the container locally.

Suggested Fixes

Diagnostic step 1
kubectl logs <pod> --previous and kubectl logs <pod> to capture both the failed attempt and current logs. If logs are empty, run kubectl exec into a recreated pod or create a debug pod using the same image and start an interactive shell. Result meaning: If logs show an application stack trace or explicit configuration error, follow that message. If logs are empty and the container exits before stdout/stderr flush, the issue may be early process failure or PID 1 problems; an interactive shell will allow inspection of files and env.
Diagnostic step 2
Temporarily remove or widen liveness/readiness probe (or set initialDelaySeconds to a high value) and redeploy. Result meaning: If pod becomes Ready after disabling/widening probes, the probe configuration is killing the container too soon — adjust path, port, timeouts, or startupProbe instead of livenessProbe for slow start.
Diagnostic step 3
Compare Deployment environment variables, mounted ConfigMaps/Secrets and volumes with a local reproduced container (docker run or ctr run) using the same image and env values. Result meaning: If container runs locally with same config, cluster runtime or node permissions are implicated. If it fails locally with same error, configuration or build is at fault.

Continue troubleshooting

Matched from the title, description and tags