Back to results for “Deployment”
Node.js › Docker & Deployment

What is a Kubernetes Deployment's rolling update strategy, and how does it apply to updating a running Node.js application?

Advanced

Answer

A rolling update incrementally replaces old pod instances with new ones, controlled by maxUnavailable (how many pods can be down simultaneously during the rollout) and maxSurge (how many extra pods above the desired count can be created temporarily) -- this ensures the application remains available throughout the deployment, with Kubernetes automatically pausing the rollout if new pods fail their readiness probe, preventing a broken new version from fully replacing a working old one.
spec:
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  replicas: 5
Real-world example A five-replica Node.js deployment configured with maxUnavailable: 1 and maxSurge: 1 rolls out a new version one pod at a time, always keeping at least four healthy pods serving traffic, and automatically halting the rollout if the new pods start failing their readiness checks.

Common follow-ups: What happens to a rolling update if the new version's pods never become ready -- does it eventually roll back automatically?;How do maxUnavailable and maxSurge together affect both deployment speed and availability during the rollout?