Bird
0
0

What happens if you run kubectl debug pod/web-2 --image=busybox -- sh but the pod web-2 is in CrashLoopBackOff state?

medium📝 Command Output Q5 of 15
Kubernetes - Troubleshooting
What happens if you run kubectl debug pod/web-2 --image=busybox -- sh but the pod web-2 is in CrashLoopBackOff state?
AThe pod is automatically restarted
BDebug container starts successfully in the pod's namespace
Ckubectl debug fails because the pod is not running
Dkubectl debug deletes the pod
Step-by-Step Solution
Solution:
  1. Step 1: Understand pod state impact

    If the pod is in CrashLoopBackOff, it is not in a stable running state, so kubectl debug cannot attach a debug container.
  2. Step 2: Check command behavior

    The debug command fails because it requires the pod to be running to create a debug container in its namespace.
  3. Final Answer:

    kubectl debug fails because the pod is not running -> Option C
  4. Quick Check:

    Pod must be running for kubectl debug to succeed [OK]
Quick Trick: Pod must be running; CrashLoopBackOff blocks debug container [OK]
Common Mistakes:
  • Assuming debug starts despite pod crash
  • Thinking pod restarts automatically
  • Confusing debug with pod deletion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes