DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Kubernetes Tutorial

Introduction to Kubernetes
Kubernetes Architecture
Installing Kubernetes
kubectl Basics
Kubernetes Pods
Kubernetes Deployments
Kubernetes Services
ConfigMaps and Secrets
Kubernetes Storage
Kubernetes Namespaces
Kubernetes Resource Management
Helm for Kubernetes
Kubernetes Monitoring

Kubernetes Rolling Updates

PreviousPrev
Next

Learn how Deployments replace old pods gradually, what maxSurge and maxUnavailable do, and how old ReplicaSets support safe transitions.

What Is a Rolling Update?

A rolling update replaces old pods with new ones gradually instead of dropping everything at once. That reduces downtime risk.

Default Strategy

Deployments use the RollingUpdate strategy by default.

Two important tuning fields are:

  • maxSurge
  • maxUnavailable

What These Fields Mean

FieldMeaning
maxSurgeHow many extra pods can be created above the desired replica count during the rollout
maxUnavailableHow many existing pods can be unavailable during the rollout

Update the Image Imperatively

kubectl set image deployment/web nginx=nginx:1.28
kubectl rollout status deployment/web

Rolling Update Wave

Desired replicas: 4

Old RS: [A][A][A][A]
New RS: [ ][ ][ ][ ]

Wave 1: create 1 new, remove 1 old
Old RS: [A][A][A]
New RS: [B]

Wave 2:
Old RS: [A][A]
New RS: [B][B]

Wave 3:
Old RS: [A]
New RS: [B][B][B]

Wave 4:
Old RS: [ ]
New RS: [B][B][B][B]

Why the Old ReplicaSet Is Kept

Kubernetes usually keeps the old ReplicaSet, often scaled to 0, so rollback is faster and rollout history remains available.

A Safer Deployment Habit

kubectl set image deployment/web nginx=nginx:1.28
kubectl rollout status deployment/web
kubectl get rs

This lets you confirm the new rollout before moving on.

Rolling updates are like swapping airplane passengers section by section instead of pushing everyone out at once. Controlled change lowers risk.

Exercise

maxSurge Purpose

What does `maxSurge` control during a rolling update?

Exercise

Old ReplicaSet Reason

Why does Kubernetes usually keep the old ReplicaSet after a rollout?

PreviousPrev
Next

Continue Learning

Kubernetes Probes

Use liveness, readiness, and startup probes to help Kubernetes know when your containers are healthy and ready for traffic.

20 min·Easy

Kubernetes Deployments

Learn why Deployments are the standard way to run stateless applications and how they manage ReplicaSets and pods.

16 min·Easy

Creating Kubernetes Deployments

Write a Deployment manifest, apply it, inspect rollout status, scale replicas, and understand selector mechanics.

20 min·Easy

Explore Related Topics

Do

Docker Tutorials

Build the containers Kubernetes orchestrates

Te

Terraform Tutorials

Provision Kubernetes clusters as code

Try the Tool

YAML Validator

Validate Kubernetes manifests and any YAML files instantly.

On This Page

What Is a Rolling Update?Default StrategyWhat These Fields MeanUpdate the Image ImperativelyRolling Update WaveWhy the Old ReplicaSet Is KeptA Safer Deployment Habit