Courseiva
Container Orchestration →mediumMultiple Choice

KCNA Container Orchestration Practice Question

Which command would you use to get the logs of a pod named 'backend' in the 'production' namespace?

⚠ Common exam trap

Common mistakes include using `kubectl get logs` (invalid), using the singular `kubectl log`, or omitting the namespace flag. Note that the `pod/` prefix is optional and valid but not required.

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 -n production pod/backend

Both option C (`kubectl logs -n production pod/backend`) and option D (`kubectl logs backend --namespace=production`) are valid and functionally equivalent. kubectl accepts the pod name with or without the `pod/` prefix, and flags can appear before or after the resource argument. Options A (`kubectl log`, singular) and B (`kubectl get logs`) are invalid commands. Since two options are correct, the question is ambiguous as written.

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 log pod backend -n production

    Why it's wrong here

    Incorrect. The subcommand is `logs`, not `log`.

  • ✗

    kubectl get logs backend -n production

    Why it's wrong here

    Incorrect. The command is `kubectl logs`, not `kubectl get logs`.

  • ✓

    kubectl logs -n production pod/backend

    Why this is correct

    Correct. This command correctly uses `kubectl logs` with the namespace flag and the pod name, optionally prefixed with `pod/`.

  • ✓

    kubectl logs backend --namespace=production

    Why this is correct

    Correct. This is another valid syntax using `--namespace` flag.

About these practice questions

One of 930 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 →

How Courseiva writes practice questions · Editorial policy

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.