Sobes.tech
Middle+

How does Kubernetes update a Deployment when applying a new configuration (rolling update)?

sobes.tech AI

Answer from AI

Kubernetes uses a rolling update strategy when updating a Deployment, which allows gradually replacing old Pods with new ones without downtime.

Main steps:

  1. A new ReplicaSet is created with the updated configuration.
  2. The number of Pods in the old ReplicaSet is gradually decreased, and in the new one increased, usually by one or according to the parameters maxUnavailable and maxSurge.
  3. Kubernetes monitors the state of the new Pods, waits for their readiness, before deleting the old ones.
  4. If the new Pods do not become Ready, the update is paused (rollback is possible).

Example deployment parameters for managing updates:

strategy:
  type: RollingUpdate
  rollingUpdate:
    maxUnavailable: 1
    maxSurge: 1

Thus, the update occurs smoothly, without service interruption, with control over availability and rollback capability.

How does Kubernetes update a Deployment when applying… - sobes.tech