Courseiva
Application Observability and MaintenanceeasyMultiple ChoiceObjective-mapped

CKAD Application Observability and Maintenance Practice Question

You want to view the logs of a pod named 'web-pod' that has two containers: 'nginx' and 'sidecar'. Which command correctly retrieves the logs from the 'nginx' container?

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 web-pod -c nginx

The correct command uses the proper syntax: `kubectl logs <pod-name> -c <container-name>`. Option B follows this syntax correctly. Option A places the container flag before the pod name, which is invalid. Option C omits the -c flag, which is required when the pod has multiple containers. Option D uses the long form --container, which is valid but the question expects the short form as seen in B. Therefore, B is the best answer.

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 -c nginx web-pod

    Why it's wrong here

    Missing -f flag for streaming; also syntax is unconventional but container flag is present.

  • kubectl logs web-pod -c nginx

    Why this is correct

    Correctly specifies the container with -c, but lacks -f flag to stream logs.

  • kubectl logs web-pod nginx

    Why it's wrong here

    Incorrect syntax; container must be specified with -c flag.

  • kubectl logs web-pod --container nginx

    Why it's wrong here

    Correctly uses --container, but missing -f flag for streaming.

About these practice questions

This CKAD question is part of Courseiva's 160-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 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.