You run 'kubectl get pods' and see a pod in 'CrashLoopBackOff'. You want to see the logs of the last crashed instance. Which command should you run?
Correct. The --previous flag retrieves logs from the previous instance.
Why this answer
The `--previous` flag (or its shorthand `-p`) tells `kubectl logs` to retrieve logs from the previous instance of a container that has crashed and restarted. Since the pod is in `CrashLoopBackOff`, the current container has already exited, and you need to inspect the logs of the last terminated container to diagnose the crash. To avoid having two correct answers, Option C has been changed to an invalid flag.
Exam trap
The trap here is that candidates often think `kubectl logs pod-name` alone will show crash logs, but it only shows logs from the currently running container (which may be empty or not yet started), and they overlook the `--previous` flag that is specifically designed for accessing logs of a terminated container.
How to eliminate wrong answers
Option B is wrong because `--all-containers` streams logs from all containers in the pod simultaneously, but it does not retrieve logs from a previous (crashed) instance; it only shows current container logs. Option C is wrong because `-p` is the shorthand for `--previous`, so this option is actually correct and identical to A; however, the question expects the explicit `--previous` flag as the answer, and `-p` is not listed as a separate correct choice. Option D is wrong because `kubectl logs pod-name` without any flag only shows logs from the currently running container; in a `CrashLoopBackOff` state, the current container may have just started and has no useful logs, or the command may fail if no container is currently running.