Courseiva
Kubernetes FundamentalsmediumMultiple ChoiceObjective-mapped

KCNA Kubernetes Fundamentals Practice Question

You want to update a Deployment's container image from 'nginx:1.20' to 'nginx:1.21' and record the change. Which kubectl command should you use?

⚠ Common exam trap

Many candidates choose option D, thinking the image update alone suffices, but they overlook the explicit requirement to 'record the change,' which is a common KCNA trick to test attention to detail with the `--record` flag.

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/nginx nginx=nginx:1.21 --record

The `kubectl set image` command directly updates the container image of a specified deployment, and the `--record` flag annotates the change in the rollout history, allowing you to track the change for auditing or rollback purposes. This is the most efficient way to update the image and record the change without editing the full deployment manifest or reapplying a file.

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 edit deployment nginx

    Why it's wrong here

    This opens an editor but does not record by default.

  • kubectl apply -f deployment.yaml

    Why it's wrong here

    This applies a manifest file; it may not record if not configured.

  • kubectl set image deployment/nginx nginx=nginx:1.21 --record

    Why this is correct

    The --record flag annotates the change for history.

  • kubectl set image deployment/nginx nginx=nginx:1.21

    Why it's wrong here

    This updates the image but does not record the change.

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 →

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.