InterviewHubPRO
Section Overview
Q34

Question 34 of 50

Part 3: Production K8s Scaling, Reliability & SRE (26 - 35)

68%
DevOps & Kubernetes (50 Qs)•Part 3: Production K8s Scaling, Reliability & SRE (26 - 35)

How do you systematically troubleshoot CrashLoopBackOff, ImagePullBackOff, and Pending Pods?

Step-by-Step Production Troubleshooting Guide

When a Pod fails to reach Running state, execute this diagnostic flow before making code or configuration changes.

scss
[ Pod Status Abnormal ]
          |
          +---> [ Pending ] --------> 1. kubectl describe pod (Check Scheduler Events, CPU/Mem, Affinity)
          |
          +---> [ ImagePullBackOff ] -> 2. Check Image Name, Tag, and imagePullSecrets
          |
          +---> [ CrashLoopBackOff ] -> 3. kubectl logs --previous (Inspect crash stack trace)

Diagnostic Checklist Matrix

Error StateRoot CauseImmediate Diagnostic CommandFix Action
PendingNode resources exhausted, node selector mismatch, or unfulfilled PVC.`kubectl describe pod <pod>grep -A 10 Events:`
ImagePullBackOffTag typo, non-existent repository, or registry authentication failure.kubectl describe pod <pod>Verify image tag; check imagePullSecrets for private registries (ECR/DockerHub).
CrashLoopBackOffContainer starts, encounters fatal error (exit code 1 or 137), and exits.kubectl logs <pod> --previousInspect application logs just before crash; verify DB connection strings and config files.
CreateContainerConfigErrorMissing ConfigMap or Secret referenced in Pod spec.kubectl describe pod <pod>Create the missing ConfigMap/Secret or fix key names.

Pro-Tip: Ephemeral Debug Containers

For distroless or hardened containers without a shell, attach an interactive debug container directly into the pod’s network and process namespace:

bash
kubectl debug -it <crashing-pod> --image=nicolaka/netshoot --target=app-container