Cloud and Container Basics
In a Kubernetes Deployment, the container image in the Pod template is changed to a new version. Which of the following correctly describes what happens with the default update strategy (RollingUpdate)?
- AA new ReplicaSet is created, and Pods of the new version are added while Pods of the old version are removed. The old ReplicaSet stays with 0 Pods for rollback
- BThe container image inside the running Pods is replaced with the new version in place without recreating the Pods, so neither the Pods' IP addresses nor their names change
- CAll Pods of the old version are deleted at once and then the Pods of the new version are created together, so the service stops temporarily during the update
Show answer and explanation
Answer: A. A new ReplicaSet is created, and Pods of the new version are added while Pods of the old version are removed. The old ReplicaSet stays with 0 Pods for rollback
When the Pod template changes, a Deployment creates a ReplicaSet for the new template and, while confirming that new Pods have become ready, gradually reduces the Pods of the old ReplicaSet. A certain number of Pods therefore keep handling requests during the update. The old ReplicaSet is kept with 0 Pods, so kubectl rollout undo can return to the previous version. The strategy that deletes all Pods first and then recreates them is Recreate, which is used only when specified explicitly.
- A. Correct. Pods are replaced gradually while switching ReplicaSets.
- B. Container images are never swapped in place inside a Pod. New Pods are created, and their IP addresses change.
- C. This is the behavior of the Recreate strategy. The default RollingUpdate replaces Pods gradually.