KCNA Kubernetes Fundamentals Practice Question
A developer created a Deployment with image 'myapp:v1' and then ran 'kubectl set image deployment/myapp myapp=myapp:v2'. What is the effect of this command?
⚠ Common exam trap
CNCF often tests the distinction between updating a Deployment's pod template (which triggers a rolling update) versus directly restarting pods or modifying Services, leading candidates to mistakenly think the command affects Service selectors or creates a new Deployment.
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
✓
It updates the Deployment's pod template to use the new image, triggering a rolling update.
The `kubectl set image deployment/myapp myapp=myapp:v2` command updates the pod template within the Deployment's specification to use the new image `myapp:v2`. This change triggers a rolling update, where the Deployment controller creates new pods with the updated image and gradually terminates old pods, ensuring zero downtime. The command does not affect Services, create new Deployments, or restart pods immediately without a rolling update strategy.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
It updates the Service selector to point to pods with the new image.
Why it's wrong here
The command only changes the image in the Deployment; it does not modify Services.
- ✓
It updates the Deployment's pod template to use the new image, triggering a rolling update.
Why this is correct
The command modifies the Deployment's container image, initiating a rolling update.
- ✗
It creates a new Deployment named 'v2' with the new image.
Why it's wrong here
The command updates the existing Deployment; it does not create a new one.
- ✗
It immediately restarts all pods with the new image.
Why it's wrong here
The update is performed as a rolling update, not an immediate restart.
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.