Courseiva
Application Observability and MaintenancemediumMultiple ChoiceObjective-mapped

CKAD Application Observability and Maintenance Practice Question

You are debugging a pod that is crashing immediately on startup. You want to run an ephemeral container for debugging while the pod is running. Which command should you use?

⚠ Common exam trap

Test-takers frequently assume `kubectl exec` works on any pod, but it fails when the target container is not running, and they overlook `kubectl debug` as the correct tool for attaching ephemeral containers to crashing pods.

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 debug -it pod --image=busybox --target=crashing-container

`kubectl debug` with the `--target` flag allows you to attach an ephemeral container to a running pod that is crashing on startup, targeting the specific container that is failing. Ephemeral containers are designed for troubleshooting when `kubectl exec` is not possible (e.g., the container has no shell or crashes immediately), and they run in the pod's namespaces without restarting the pod.

Answer analysis

Option-by-option breakdown

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

  • kubectl debug -it pod --image=busybox --target=crashing-container

    Why this is correct

    This creates an ephemeral container in the same pod for debugging, even if the main container is failing.

  • kubectl run debug --image=busybox -it --rm

    Why it's wrong here

    This creates a separate pod, not an ephemeral container in the existing pod.

  • kubectl attach pod

    Why it's wrong here

    This attaches to the main process of the container, which is not useful if the container is crashing.

  • kubectl exec -it pod -- /bin/sh

    Why it's wrong here

    This command works only if the container is running; if it's crashing, exec may not work.

About these practice questions

One of 160 original CKAD practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 CKAD 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 CKAD exam.