You have a pod that is stuck in 'Pending' state. Which command would you run first to diagnose the issue?
Provides events and conditions explaining the pending state.
Why this answer
Option D is correct because `kubectl describe pod <pod>` provides detailed information about the pod's current state, including events, conditions, and resource constraints (e.g., insufficient CPU/memory, persistent volume claims pending). This is the first diagnostic step for a 'Pending' pod, as it surfaces the root cause (e.g., node resource pressure, PVC binding failures) without requiring additional commands.
Exam trap
The trap here is that candidates often jump to `kubectl logs` (Option A) thinking it shows startup errors, but logs are only available after containers start, making it useless for a 'Pending' pod; instead, `kubectl describe pod` is the standard first diagnostic tool for scheduling and resource issues.
How to eliminate wrong answers
Option A is wrong because `kubectl logs <pod>` retrieves container logs, which are only available if the pod has started running; a 'Pending' pod has not yet scheduled or started containers, so logs are empty or inaccessible. Option B is wrong because `kubectl get pods` only shows the pod's status (e.g., 'Pending') and basic metadata, not the underlying reasons for the pending state (e.g., unschedulable, image pull errors). Option C is wrong because `kubectl get events` lists cluster-wide events, which may include relevant scheduling failures, but it is less targeted than `kubectl describe pod`, which filters events specific to the pod and presents them alongside other critical details like node selector mismatches or taint tolerations.