Courseiva
Troubleshooting →mediumMultiple Choice

CKA Troubleshooting Practice Question

You need to check the memory usage of all pods in the 'production' namespace. Which command fulfills this requirement?

⚠ Common exam trap

It's easy for candidates to confuse `kubectl describe` (which shows resource requests/limits but not actual usage) with `kubectl top` (which shows live consumption), or they mistakenly think `kubectl get pod -o wide` includes resource metrics.

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 pod --namespace=production

`kubectl top pod --namespace=production` directly queries the metrics-server to retrieve real-time CPU and memory usage for each pod in the specified namespace. This command leverages the Kubernetes Metrics API to display resource consumption, making it the precise tool for checking memory usage of pods.

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 get pod --namespace=production -o wide

    Why it's wrong here

    kubectl get pod --namespace=production -o wide displays a wide table of pod metadata, including the pod's IP address, nominated node, and labels, but it never queries the kubelet for runtime metrics such as resident memory. This command only reports static scheduling and spec information, so it cannot satisfy the requirement to check memory usage. The -o wide flag merely changes the output columns, not the underlying data source.

  • ✗

    kubectl describe pod --namespace=production

    Why it's wrong here

    kubectl describe pod --namespace=production shows a detailed object manifest-style summary, including container images, volumes, events, and resource requests/limits if they are declared in the spec. However, that 'requests/limits' section is a declaration of what the pod is allowed to use, not a live measurement of actual memory consumption. The describe command does not connect to cAdvisor or the metrics-server, so it gives a static spec view and cannot answer the question of current memory usage.

  • ✗

    kubectl top node

    Why it's wrong here

    kubectl top node outputs the CPU and memory utilization aggregated at the node level, showing the total usage across all pods running on that particular worker, but it does not present a per-pod breakdown. If you run it against a production cluster, you cannot determine which specific pod is consuming memory; the data is summed and only displays node-scoped totals, missing the namespace/name granularity requested. This is a different scope problem from per-pod commands and therefore does not fulfill the requirement.

  • ✓

    kubectl top pod --namespace=production

    Why this is correct

    kubectl top pod --namespace=production is the correct kubectl command because it directly queries the metrics-server, which receives its data from kubelet cAdvisor, and returns the current CPU and memory usage for every pod in the production namespace. This is the only option among the four that actually measures live runtime memory consumption per pod, exactly satisfying the requirement. It produces a table with columns for NAME, CPU(cores), and MEMORY(bytes); note that without an explicit --namespace flag, kubectl top pod would default to the current namespace, so specifying production is essential.

About these practice questions

One of 726 original CKA 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 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.