Typorithm · medium

Rollout Strategy

rollout-strategykubernetesstrategyrolling-updatezero-downtime
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn Rollout Strategy

0%

Workloads

spec.strategy controls how a Deployment swaps Pods. RollingUpdate with maxUnavailable: 0 and maxSurge: 1 brings up a new Pod before retiring an old one — zero downtime.

When a Deployment's template changes, spec.strategy decides how the old Pods are replaced by new ones.

type: RollingUpdate replaces Pods incrementally; the alternative type: Recreate deletes all old Pods before creating new ones, causing a gap.

maxSurge sets how many extra Pods may run above the desired count, and maxUnavailable sets how many may be missing. maxUnavailable: 0 with maxSurge: 1 means a new Pod becomes Ready before an old one is removed — true zero-downtime rollouts.

01

type: RollingUpdate replaces Pods gradually.

02

maxSurge: extra Pods allowed above desired.

03

maxUnavailable: 0 keeps full capacity online.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 4
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0

Read the implementation

Connect each part of the code to the concept before you type.

1. Strategy type

RollingUpdate replaces Pods gradually; the alternative, Recreate, kills all old Pods first.

type: RollingUpdate

2. Rolling parameters

rollingUpdate tunes how many Pods may be added or taken down during the swap.

rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0

3. Extra Pods allowed

maxSurge is how many Pods above the desired count may exist mid-rollout.

maxSurge: 1

4. Zero downtime

maxUnavailable: 0 keeps full capacity available throughout the rollout.

maxUnavailable: 0

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

Rollout Strategy: Lesson & Practice · Typorithm | ApplyDjinn