Bird
0
0

You want to update a running deployment named webapp to use a new image version webapp:v2 without downtime. Which kubectl command should you use?

hard📝 Best Practice Q15 of 15
Kubernetes - kubectl Essential Commands
You want to update a running deployment named webapp to use a new image version webapp:v2 without downtime. Which kubectl command should you use?
Akubectl set image deployment/webapp webapp=webapp:v2
Bkubectl delete deployment webapp && kubectl create deployment webapp --image=webapp:v2
Ckubectl apply -f webapp-v2.yaml without changing image
Dkubectl scale deployment webapp --replicas=0
Step-by-Step Solution
Solution:
  1. Step 1: Identify the goal

    You want to update the image of the deployment without downtime, meaning a rolling update.
  2. Step 2: Choose the correct kubectl command

    kubectl set image deployment/webapp webapp=webapp:v2 updates the image and triggers a rolling update safely.
  3. Step 3: Understand why other options fail

    Deleting and recreating causes downtime; applying without image change does nothing; scaling to zero stops pods.
  4. Final Answer:

    kubectl set image deployment/webapp webapp=webapp:v2 -> Option A
  5. Quick Check:

    Use 'kubectl set image' for zero-downtime update [OK]
Quick Trick: Use 'kubectl set image' for rolling updates [OK]
Common Mistakes:
  • Deleting deployment causes downtime
  • Applying without image change does not update
  • Scaling to zero stops the app

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes