Latest
Kubernetes 1 min read

Update an Application with a Kubernetes Rolling Deployment

Update an Application with a Kubernetes Rolling Deployment
Kubernetes · November 28, 2026

Version note: examples use the Kubernetes v1.35 documentation snapshot, not necessarily the newest release. Check current support and component compatibility. These commands were not tested on a live cluster.

What this guide covers

A rolling update replaces old Pods gradually. maxSurge controls extra Pods during the update; maxUnavailable controls how many requested Pods may be unavailable. Readiness checks determine when new Pods can receive traffic.

Before you start

Create rolling-lab in a test cluster. You need capacity for the old and temporary new Pods, compatible application versions and a known working replacement image.

Step 1: Create the starting Deployment

Save this as rolling.yaml and apply it:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  namespace: rolling-lab
spec:
  replicas: 3
  minReadySeconds: 10
  progressDeadlineSeconds: 180
  revisionHistoryLimit: 5
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      terminationGracePeriodSeconds: 30
      containers:
        - name: web
          image: nginx:1.28.0
          ports:
            - name: http
              containerPort: 80
          readinessProbe:
            httpGet:
              path: /
              port: http
            periodSeconds: 5
          resources:
            requests:
              cpu: 100m
              memory: 64Mi
            limits:
              memory: 128Mi

Run kubectl apply -f rolling.yaml. maxUnavailable: 0 prevents a planned reduction in available replicas, but it cannot prevent every outage. The node still needs room for the extra Pod.

Step 2: Set the new image

Run:

kubectl -n rolling-lab rollout status deployment/web --timeout=180s
read -r -p 'Approved new image reference, preferably pinned by digest: ' NEW_IMAGE
kubectl -n rolling-lab set image deployment/web web="$NEW_IMAGE"
kubectl -n rolling-lab get replicasets,pods -l app=web --watch
kubectl -n rolling-lab rollout status deployment/web --timeout=240s

Enter the replacement image reference. The watch command keeps running; stop it with Ctrl+C or run the final rollout check in another terminal.

Step 3: Check or undo the update

If the new version is unhealthy, inspect the cause and use rollback if compatible:

kubectl -n rolling-lab describe deployment web
kubectl -n rolling-lab rollout history deployment/web
kubectl -n rolling-lab rollout undo deployment/web
kubectl -n rolling-lab rollout status deployment/web --timeout=240s

Keep the manifest or deployment source in sync with the chosen version. A controller may otherwise reapply the unwanted image.

Check the result

Check the rollout and actual application responses. An image rollback does not undo database changes or external side effects, and readiness checks must reflect real ability to serve requests.

References

PB
Written by

Parul Bedi

Notes and guides by Parul Bedi.

Up next

Install SonarQube on Ubuntu Step by Step

Sonar November 30, 2026 4 min read
Open post

Conversation

0 comments

No comments yet. Start the conversation below.

Leave a comment

Replying to a comment.
Be kind. Markdown is not supported in comments.