Get Your CertGoogle Cloud Associate Cloud EngineerPlayCompete
‹ All Google Cloud Associate Cloud Engineer questions

GCP Associate Cloud Engineer Practice Question 26: kubectl Rollout Undo

Google Cloud Associate Cloud Engineer · Test 3 · question 6 of 10

Google Kubernetes Engineeasy

You updated the container image of the Deployment web with kubectl set image. The new pods crash on startup and users see errors. You need to return to the previous working version as quickly as possible.

Which command should you run?

Select one answer
Show answer and explanation

Answer:

  • A. kubectl rollout undo deployment/web

Every change to a Deployment's pod template creates a new revision. kubectl rollout undo deployment/web rolls back to the previous revision (or to a specific one with --to-revision), replacing the crashing pods with pods that use the earlier image.

kubectl rollout restart recreates the pods with the current template, so they would keep crashing. Scaling to zero stops the service completely, so it does not fix the problem. kubectl rollout pause suspends further updates but leaves the bad revision running.

Reference: Rolling back a Deployment

Practice Test 3 ›

Study guides for Google Cloud Associate Cloud Engineer