Part 1 · 1 chapters · ~8 min

Rolling, Recreate and Blue-Green

Recreate for when versions cannot coexist, rolling updates with surge and unavailability settings and readiness gates, blue-green with a full second environment and an instant switch, and the shared database that complicates every strategy.

2

Three replacement strategies

code
# Kubernetes rolling update: never below desired capacity, one extra pod at a time
spec:
  replicas: 10
  strategy: { type: RollingUpdate, rollingUpdate: { maxSurge: 1, maxUnavailable: 0 } }
  minReadySeconds: 20                      # a pod must stay ready 20 s before it counts
  template:
    spec:
      containers:
      - name: ledger
        readinessProbe: { httpGet: { path: /readyz, port: 8080 }, periodSeconds: 5 }
      terminationGracePeriodSeconds: 45    # longer than the app's drain time (Node course P7)
strategydowntimemixed versionsextra capacityrollback speed
recreateyesnononeanother deploy
rollingnoyes, during rolloutmaxSurgeanother rolling deploy
blue-greennono (at the LB)100% during switchseconds
ROLLING, RECREATE AND BLUE-GREEN
three ways to replace version 1 with version 2
load balanceror k8s Serviceblue v1blue v1green v2green v2
swipe the figure sideways, or tap expand for full screen
1/5
recreate
Stop all v1, start all v2. Simple and guarantees no mixed versions, at the cost of downtime. Acceptable for batch workers or when two versions cannot coexist.
stop everything, start everythingdowntime, but never mixed versions