KCNA Container Orchestration Practice Question
Which command would you use to view the logs of a specific container in a multi-container pod, using the short flag?
⚠ Common exam trap
The CNCF exam may test that the short flag `-c` is the primary way to specify a container, while being aware that `--container` is also valid.
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 mypod -c mycontainer
The command `kubectl logs mypod -c mycontainer` uses the short flag `-c` to specify the container name in a multi-container pod. The long form `--container` also works, but the exam may specifically expect the short flag syntax. Option A uses `-p` which retrieves logs from a previous instance. Option D provides the container name as a positional argument, which is incorrect.
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 logs mycontainer -p mypod
Why it's wrong here
Incorrect: The `-p` flag is used to view logs from a previously terminated container instance, not to specify the container name.
- ✗
kubectl logs mypod --container mycontainer
Why it's wrong here
Incorrect: Although `--container` is a valid long flag to specify the container, the question specifically asks for the command using the short flag.
- ✓
kubectl logs mypod -c mycontainer
Why this is correct
Correct: The short flag `-c` is used to specify the container in a multi-container pod.
- ✗
kubectl logs mypod mycontainer
Why it's wrong here
Incorrect: The container name must be specified using a flag (`-c` or `--container`); it cannot be provided as a positional argument.
Go deeper
Related to this question
About these practice questions
One of 833 original KCNA 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This KCNA 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 KCNA exam.