100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What Is a Rolling Update?

Understand what a rolling update is in Kubernetes deployments, how maxSurge and maxUnavailable work, and how to explain it in interviews.

easyQ21 of 224 in DevOps Est. time: 4 minsLast updated:
Open Code Lab

Expected Interview Answer

A rolling update is a deployment strategy that incrementally replaces old instances of an application with new ones, a few at a time, so the service remains available throughout the release with no full downtime.

In Kubernetes, a rolling update terminates a small batch of old pods and creates an equal or configured number of new pods running the updated image, waiting for each new pod to pass its readiness probe before proceeding to the next batch. Parameters like maxUnavailable and maxSurge control how many pods can be down or how many extra pods can run simultaneously during the transition. If a new pod fails its health check, the rollout can be paused or automatically rolled back to the previous ReplicaSet. This contrasts with a recreate strategy, which kills all old instances before starting any new ones, causing downtime.

  • Zero-downtime releases for end users
  • Automatic pause or rollback on failed health checks
  • Gradual exposure limits blast radius of a bad release
  • No need for a separate maintenance window

AI Mentor Explanation

A rolling update is like a team substituting players one at a time during a long tournament rather than benching the entire eleven at once. A fresh player enters, the coach watches them perform for an over or two to confirm they are match-fit, and only then does another substitution happen. If the new player struggles badly, the coach can bring the previous player back before making further changes. This way the team always has eleven fit players on the field, never fielding a depleted side while transitioning to the new lineup.

Step-by-Step Explanation

  1. Step 1

    Trigger the update

    A new image or config is applied to the Deployment, creating a new ReplicaSet.

  2. Step 2

    Scale up new, scale down old

    A batch of new pods is created based on maxSurge while an equal batch of old pods is terminated based on maxUnavailable.

  3. Step 3

    Health check gate

    Each new pod must pass its readiness probe before the rollout proceeds to the next batch.

  4. Step 4

    Complete or roll back

    Once all pods are replaced the rollout finishes; a failing rollout can be paused or reverted to the prior ReplicaSet.

What Interviewer Expects

  • Clear explanation of incremental, batch-based replacement
  • Knowledge of maxUnavailable and maxSurge parameters
  • Awareness that readiness probes gate progression
  • Comparison against the recreate strategy and its downtime

Common Mistakes

  • Saying rolling updates guarantee zero risk instead of zero downtime
  • Forgetting that readiness probes are required for safe rollouts
  • Confusing rolling updates with blue-green deployments
  • Not mentioning rollback capability on failure

Best Answer (HR Friendly)

โ€œA rolling update is a way of releasing new software gradually, a few servers at a time, instead of switching everything over at once. This keeps the service running for users throughout the release, and if something goes wrong partway through, the team can stop and roll back before it affects everyone.โ€

Code Example

Deployment with a rolling update strategy
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-server
spec:
  replicas: 6
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    spec:
      containers:
        - name: api
          image: registry.example.com/api:2.3.0
          readinessProbe:
            httpGet:
              path: /health
              port: 8080

Follow-up Questions

  • What do maxUnavailable and maxSurge control during a rolling update?
  • How does a rolling update differ from a blue-green deployment?
  • What happens if a new pod never becomes ready?
  • How would you pause a rollout mid-way for investigation?

MCQ Practice

1. What is the main benefit of a rolling update over a recreate strategy?

Rolling updates replace pods incrementally so the service stays available, unlike recreate which kills all pods first.

2. Which field limits how many pods can be unavailable during a rolling update?

maxUnavailable caps how many pods can be down at once; maxSurge caps how many extra pods can run beyond the desired count.

3. What gates progression from one batch of new pods to the next during a rolling update?

Kubernetes waits for new pods to report ready via their readiness probe before continuing the rollout.

Flash Cards

What is a rolling update? โ€” A deployment strategy that replaces old instances with new ones incrementally to avoid downtime.

What does maxSurge control? โ€” The maximum number of extra pods that can be created above the desired replica count during a rollout.

What does maxUnavailable control? โ€” The maximum number of pods that can be unavailable during a rollout.

What strategy causes downtime by killing all old pods first? โ€” The recreate strategy.

1 / 4

Continue Learning