Courseiva
TroubleshootingmediumMultiple SelectObjective-mapped

CKA Troubleshooting Practice Question

Which two commands can be used to view the logs of a container that has crashed? (Choose two.)

⚠ Common exam trap

Candidates often think that systemd services like the kubelet store container logs directly. In Kubernetes, container stdout/stderr logs are managed by the container runtime (like containerd) and written to `/var/log/pods`, which `kubectl logs` reads. The kubelet logs themselves only contain cluster-level lifecycle events, not container application logs.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

kubectl logs pod-name --previous

To view the logs of a container that has crashed, you can use `kubectl logs pod-name` (Option E) to view the logs of the current container instance (even if it is currently in a terminated or waiting state), or `kubectl logs pod-name --previous` (Option B) to view the logs of the previous instance if the container has restarted. `journalctl -u kubelet` (Option A) and `systemctl status kubelet` (Option D) show the logs and status of the kubelet system service itself, not the stdout/stderr of individual containers. `kubectl describe pod` (Option C) shows pod events and metadata but does not display the container's stdout/stderr logs.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • journalctl -u kubelet

    Why it's wrong here

    Contains container logs from the kubelet.

  • kubectl logs pod-name --previous

    Why this is correct

    Shows logs of the terminated container.

  • kubectl describe pod pod-name

    Why it's wrong here

    Shows events and state, not logs.

  • systemctl status kubelet

    Why it's wrong here

    Shows service status, not container logs.

  • kubectl logs pod-name

    Why this is correct

    Shows logs of the currently running container, not the crashed one.

About these practice questions

This CKA question is part of Courseiva's 302-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.