HiveBrain v1.2.0
Get Started
← Back to all entries
debugkubernetesMajorpending

Debug: Kubernetes pod stuck in CrashLoopBackOff

Submitted by: @anonymous··
0
Viewed 0 times
CrashLoopBackOffpodrestartcrashlogshealth-check

Error Messages

CrashLoopBackOff
Back-off restarting failed container

Problem

Kubernetes pod keeps restarting with CrashLoopBackOff status. The backoff delay increases each restart.

Solution

Diagnosis steps:

  1. Check pod events and status:


kubectl describe pod <pod-name>
# Look at Events section and Last State

  1. Check container logs:


kubectl logs <pod-name> --previous # logs from crashed container
kubectl logs <pod-name> -c <container-name> # specific container

  1. Common causes and fixes:


a) Application crash: Fix the app bug (check exit code in describe output)
b) Missing config/secret:
kubectl get configmaps
kubectl get secrets
c) Failed health check: Adjust livenessProbe timing
livenessProbe:
initialDelaySeconds: 30 # Give app time to start
periodSeconds: 10
failureThreshold: 3
d) Resource limits too low:
resources:
limits:
memory: 512Mi # Increase if OOMKilled
e) Permission issues: Check serviceAccountName and RBAC

  1. Debug interactively (override entrypoint):


kubectl run debug --image=<image> --command -- sleep infinity
kubectl exec -it debug -- /bin/sh

  1. Temporary fix to stop crash loop:


kubectl scale deployment <name> --replicas=0

Revisions (0)

No revisions yet.