Courseiva
TroubleshootingeasyMultiple ChoiceObjective-mapped

CKA Troubleshooting Practice Question

You want to view the resource usage of all pods in the cluster. What command should you run?

⚠ Common exam trap

CNCF often tests the distinction between `kubectl top pods` and `kubectl top nodes`, where candidates mistakenly choose `kubectl top nodes` thinking it covers all pods, but it only shows node-level aggregates, not per-pod usage.

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 top pods --all-namespaces

The `kubectl top pods --all-namespaces` command retrieves real-time CPU and memory usage metrics for all pods across every namespace in the cluster. This is the correct way to view resource usage of all pods, as it relies on the metrics server to collect and expose pod-level resource consumption data.

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 top pods --all-namespaces

    Why this is correct

    kubectl top pods --all-namespaces is the correct command because it retrieves current CPU and memory utilization for every pod running in every namespace. It sources these figures from the metrics API (backed by metrics-server) and displays them per pod along with the pod's namespace and node. Because the question asks for resource usage of all pods cluster-wide, this command is the only one that directly provides that data without omitting any namespace.

  • kubectl describe nodes

    Why it's wrong here

    kubectl describe nodes provides detailed node information including capacity, allocatable resources, and current resource requests/limits, but it does not show live pod resource usage like CPU or memory consumed. Its node-level output describes conditions, taints, and events, but it lists neither individual pod metrics nor any real-time utilization percentages. Since the question targets pod resource usage, this command lacks the required scope and granularity.

  • kubectl get pods -o wide

    Why it's wrong here

    kubectl get pods -o wide adds node names and pod IP addresses to the standard pod list, but it shows no CPU or memory usage metrics at all. The -o wide output format is about expanding columns with networking and scheduling details, not about querying the metrics API. Therefore, while it gives a broader view of pod placement, it cannot answer a question about resource consumption.

  • kubectl top nodes

    Why it's wrong here

    kubectl top nodes is a metrics command that reports CPU and memory usage aggregated per node, not per individual pod. It calls the metrics API for node-level metrics, so it tells you how busy each worker is but completely omits which pods are consuming those resources. To inspect pod-level usage, you must use the pod variant of the top command, making this option incorrect for the stated goal.

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.