Courseiva
Kubernetes FundamentalsmediumMultiple ChoiceObjective-mapped

KCNA Kubernetes Fundamentals Practice Question

You need to update a running Deployment to use a new container image. Which kubectl command should you use?

⚠ Common exam trap

CNCF often tests whether candidates know that `kubectl set image` is the idiomatic, single-purpose command for updating container images, versus using more complex or less appropriate commands like `kubectl replace` or `kubectl patch`.

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 set image deployment/<name> <container>=<new-image>

`kubectl set image` is the dedicated command for updating the container image of a running Deployment without modifying the entire manifest. It directly updates the Deployment's pod template spec, triggering a rolling update to replace pods with the new image.

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 replace -f deployment.yaml

    Why it's wrong here

    This requires modifying the YAML file manually, not a direct command.

  • kubectl set image deployment/<name> <container>=<new-image>

    Why this is correct

    This command directly updates the image.

  • kubectl edit deployment <name>

    Why it's wrong here

    This opens an editor but is not the most direct command.

  • kubectl patch deployment <name> -p '{"spec":{"template":{"spec":{"containers":[{"name":"<container>","image":"<new-image>"}]}}}}'

    Why it's wrong here

    While possible, it's more complex and less common than set image.

About these practice questions

This KCNA question is part of Courseiva's 833-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 →

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.