✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes Deployment Rolling Update Management

Kubernetes Deployment Rolling Update Management ensures smooth updates by gradually replacing old pods with new ones, minimizing downtime.

Kubernetes Deployment Rolling Update Management is the specific practice of tuning the RollingUpdate strategy's numeric parameters, maxSurge, maxUnavailable, and their interaction with minReadySeconds, to match a workload's actual capacity and connection-handling characteristics. This is narrower than general rollout management: it is the arithmetic and reasoning behind the specific numbers chosen, not the surrounding process of canarying or communicating a change.


Understanding maxSurge and maxUnavailable Together

The Combined Effective Range

maxSurge and maxUnavailable are independent but interact to define the total range of Pod counts present during an update. With replicas: 10, maxSurge: 2, and maxUnavailable: 1, the controller may run as few as 9 and as many as 12 Pods simultaneously at any point in the transition.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rolling-update-management-example
spec:
  replicas: 10
  strategy:
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1

Percentage-Based Values at Scale

Expressing these as percentages rather than fixed integers keeps the effective surge and unavailability proportional as replica count changes, useful for Deployments whose scale varies across environments without requiring the rollout parameters to be separately tuned for each.

spec:
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 10%

Zero Unavailability Configurations

maxUnavailable: 0 Forces Create-Before-Delete

Setting maxUnavailable: 0 guarantees full capacity is maintained throughout the rollout by requiring new Pods to become ready before any old ones are terminated, at the cost of requiring maxSurge to be at least 1, since otherwise no new Pods could ever be created to replace the old ones.

spec:
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0

Downstream Capacity Considerations

Surge Impact on Shared Resources

A high maxSurge value increases the peak number of concurrent Pods during rollout, which can matter for workloads holding limited external resources, database connection pool slots, licensed software seats, where exceeding a hard external limit during the surge window causes failures unrelated to the application code itself.

spec:
  strategy:
    rollingUpdate:
      maxSurge: 1

A conservative surge value like this one limits peak concurrent connections to just one Pod's worth above steady state, at the cost of a slower overall rollout.


minReadySeconds as a Pacing Multiplier

Slowing the Effective Rollout Rate

Because the controller only proceeds to the next batch once currently transitioning Pods are counted as available, not merely ready, a nonzero minReadySeconds directly multiplies total rollout duration by however many sequential batches the surge and unavailability settings produce.

spec:
  minReadySeconds: 20

With ten replicas and a surge of one, a twenty-second minReadySeconds adds roughly that same delay at each of ten sequential steps, meaningfully extending total rollout time in exchange for greater confidence in each step's stability.


Choosing Values for Different Workload Profiles

Stateless Web Tier Versus Connection-Heavy Backend

A stateless, horizontally scalable web tier can typically tolerate aggressive surge and moderate unavailability, favoring rollout speed. A backend service managing persistent client connections or expensive warm-up state benefits from lower surge and zero unavailability, favoring stability over speed.


Rolling Update Tuning Diagram

time through rollout 12 surge ceiling 10 desired 9 unavailable floor

Tuning these three parameters as a coordinated set, rather than adjusting each in isolation, is what allows a rollout to be paced deliberately against a workload's true tolerance for both reduced capacity and excess concurrent instances.