Courseiva
Kubernetes Fundamentals →mediumMultiple Choice

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 patches the Deployment's pod template, triggering a rolling update; it never touches Service objects, whose selectors match labels rather than image names. Editing a Service selector is what you would do to redirect traffic to a differently labelled pod set, not to roll out a new image version.

  • ✓

    It updates the Deployment's pod template to use the new image, triggering a rolling update.

    Why this is correct

    The set image command patches the Deployment's pod template with myapp:v2. The Deployment controller then creates a new ReplicaSet and progressively shifts Pods from the old to the new template, performing a rolling update that maintains availability throughout.

  • ✗

    It creates a new Deployment named 'v2' with the new image.

    Why it's wrong here

    `kubectl set image` patches the existing Deployment's pod template, triggering a rolling update to `myapp:v2`; it never creates a new Deployment. It is tempting because the image tag changes. It would be correct to say a new ReplicaSet is created under the same Deployment, not a Deployment named 'v2'.

  • ✗

    It immediately restarts all pods with the new image.

    Why it's wrong here

    Kubernetes performs a rolling update, creating new pods gradually while old ones terminate, so no immediate simultaneous restart occurs. The command is tempting because it does change the running image, but that gradual replacement is exactly what a Deployment's default update strategy governs, not an instant restart.

About these practice questions

Courseiva writes every KCNA question from scratch — 930 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 →

How Courseiva writes practice questions · Editorial policy

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.