KCNA Kubernetes Fundamentals Practice Question
A pod is running a Java application that occasionally leaks memory. After a few hours, 'kubectl describe pod' shows the container exited with OOMKilled. You want to automatically restart the container but ensure the application has enough memory. What should you do?
⚠ Common exam trap
A common misconception is that restartPolicy alone solves OOMKilled issues, but without adjusting resource limits, the container will simply be killed again. Additionally, a liveness probe is needed for proactive health management.
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
✓
Increase the memory limit in the container's resources.limits and add a liveness probe that triggers on high memory usage
Increasing the memory limit in resources.limits provides the Java application with more memory headroom, reducing the likelihood of OOMKilled terminations. Adding a liveness probe that triggers on high memory usage ensures the pod is restarted proactively if memory consumption approaches the limit, maintaining availability while the underlying memory leak is addressed.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set restartPolicy: OnFailure in the pod spec
Why it's wrong here
The default restart policy for pods is Always, so it will restart anyway. Changing to OnFailure would still restart, but the core issue is memory.
- ✗
Use a DaemonSet instead of a Deployment
Why it's wrong here
This does not address the memory issue.
- ✓
Increase the memory limit in the container's resources.limits and add a liveness probe that triggers on high memory usage
Why this is correct
Increasing memory limit prevents OOM, and a liveness probe can restart the pod before OOM.
- ✗
Set terminationGracePeriodSeconds to 0
Why it's wrong here
This controls graceful shutdown, not memory.
Go deeper
Related to this question
About these practice questions
Courseiva writes every KCNA question from scratch — 833 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 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.