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)?

  1. 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
  2. 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
  3. 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.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. A Deployment with replicas: 10 has the rolling update settings maxSurge: 25% and maxUnavailable: 25%. Which of the following correctly gives the upper limit of the total number of Pods and the lower limit of the number of available Pods during an update?
  2. In Kubernetes, a Pod gets a different IP address every time it is recreated. Which of the following resources lets other applications connect, through a name and address that do not change, to several Pods selected by labels, with the load spread across them?
  3. In a Kubernetes cluster, HTTPS requests arriving for one host name should be routed to the api Service if the path begins with /api, and to the web Service otherwise. Which of the following resources is suitable for defining this routing rule?
  4. A database password is stored in a Kubernetes Secret. Which of the following correctly describes a Secret?
  5. A web application cannot handle requests for about 60 seconds after starting, while it loads its cache, and returns 503 from /ready during that time. Which of the following correctly describes the effect of adding the settings above to the Pod's container?