easyMultiple ChoiceObjective-mapped
Google ACE Practice Question: A team's GKE application is running out of memory…
A team's GKE application is running out of memory due to a memory leak. Pods are restarting with OOMKilled status. As an immediate measure before a code fix is available, what kubectl action provides the most insight into which container is leaking?
⚠ Common exam trap
Google Cloud often tests the misconception that cluster-level or event-based commands (like `kubectl get events` or `gcloud container clusters describe`) provide container-level resource diagnostics, when in fact only `kubectl top` with the `--containers` flag gives per-container memory usage in real time.
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 --containers -n [NAMESPACE]
`kubectl top pods --containers` shows per-container CPU and memory usage for each pod in the namespace. This allows you to identify which specific container within a pod is consuming excessive memory and triggering the OOMKilled status, even before a code fix is deployed. It provides immediate, real-time insight into resource consumption at the container level, which is essential for diagnosing a memory leak in a multi-container pod.
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 events --field-selector=reason=OOMKilling
Why it's wrong here
`kubectl get events --field-selector=reason=OOMKilling` displays only past OOMKill events, which are ephemeral and typically retained for only about an hour, so earlier signs of the leak may already be gone. Even when events are present, they merely indicate that the kernel killed a process due to memory pressure, without showing the container's current live memory consumption or its growth trend. This command confirms the symptom of OOM kills but lacks the per-container, real-time utilization data needed to identify which container is actually leaking.
- ✓
kubectl top pods --containers -n [NAMESPACE]
Why this is correct
`kubectl top pods --containers -n [NAMESPACE]` is the correct command because it queries the metrics-server API to show real-time CPU and memory utilization per individual container inside each Pod. This granularity is essential in GKE because a Pod often runs sidecars alongside the main application, and aggregating metrics at the Pod level can hide which container is consuming excessive memory. By comparing each container's usage to its requests and limits, you can pinpoint the leaking container and confirm the diagnosis before taking any remediation action.
- ✗
kubectl delete pod [POD_NAME] -- force=true to clear the memory leak
Why it's wrong here
Force-deleting the Pod with `kubectl delete pod --force=true` immediately terminates the container and recreates it from the same manifest, which only provides temporary relief. This action does not identify which container in the Pod is leaking memory or whether the leak is caused by the application, a sidecar, or a runtime issue, so the OOMKill will recur. Moreover, `--force=true` bypasses the graceful termination grace period, potentially leaving orphaned volumes, IP addresses, or other resources inconsistent, making it a risky operational move rather than a diagnostic step.
- ✗
gcloud container clusters describe [CLUSTER] --memory-usage
Why it's wrong here
`gcloud container clusters describe [CLUSTER] --memory-usage` is not a valid gcloud command because the `describe` subcommand has no `--memory-usage` flag; it returns static cluster configuration such as node pools, network settings, and control plane details, not runtime metrics. Even if you attempted to retrieve memory information from cluster-level monitoring, it would be far too coarse to distinguish which container in which Pod is leaking. Proper diagnostics require `kubectl top` or Cloud Monitoring per-container metrics, not cluster configuration outputs.
Go deeper
Related to this question
Learn chapter
Artifact Registry and Container Management
Key term
GKE
GKE is Google's managed Kubernetes service that automates deploying, scaling, and managing containerized applications in the cloud.
Key term
Pod
A pod is the smallest deployable unit in Kubernetes, containing one or more containers that share storage, network, and a specification for how to run.
About these practice questions
This ACE question is part of Courseiva's 769-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ACE practice question is part of Courseiva's free Google Cloud 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 ACE exam.