KCNA Kubernetes Fundamentals Practice Question
A pod is experiencing high memory usage. The administrator wants to enforce that the pod is terminated if it exceeds a memory limit and restarted automatically, but also wants to guarantee a minimum amount of memory for the pod. Which resource specification should be used in the container definition?
⚠ Common exam trap
CNCF often tests the misconception that setting only `limits.memory` is sufficient for both guarantee and enforcement, but without `requests.memory` the pod has no guaranteed minimum and may be evicted under node pressure, failing the 'guarantee a minimum' requirement.
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
✓
spec.containers[].resources.requests.memory and limits.memory
Setting both `requests.memory` and `limits.memory` guarantees a minimum memory allocation (the request) while enforcing a hard cap (the limit). If the pod exceeds the memory limit, it is terminated (OOMKilled) and, if part of a Deployment or StatefulSet, the controller automatically restarts it. This satisfies the requirement for both guaranteed minimum and enforced maximum with automatic restart.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
spec.containers[].resources.requests.memory only
Why it's wrong here
Specifying only requests.memory reserves a guaranteed minimum for scheduling, but without limits.memory the container can consume unbounded memory and is never terminated for exceeding a ceiling. Requests alone suit workloads needing guaranteed reservation where bursting beyond it is acceptable.
- ✗
spec.containers[].resources.limits.memory and requests.cpu
Why it's wrong here
This pairs limits.memory with requests.cpu, so the memory guarantee is absent; the scheduler reserves CPU rather than the minimum memory the scenario requires. Combining a memory limit with a CPU request suits CPU-sensitive workloads, not one needing a guaranteed memory floor.
- ✗
spec.containers[].resources.limits.memory only
Why it's wrong here
Setting only limits.memory caps consumption and triggers OOM termination, but provides no requests value, so the scheduler cannot reserve a guaranteed minimum; the pod may be placed on a node without sufficient allocatable memory. Limits alone suit workloads where a hard ceiling matters but minimum reservation does not.
- ✓
spec.containers[].resources.requests.memory and limits.memory
Why this is correct
Requests reserve guaranteed memory for scheduling, while limits set the ceiling the kubelet enforces; exceeding the limit triggers an OOM kill and the container restarts per its restartPolicy. Together they satisfy both the guarantee and termination requirements.
Go deeper
Related to this question
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 →
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.