Prompt

How do I set up rolling updates and rollbacks in Kubernetes?

Technology / Cloud Infrastructure1 observationLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

In Kubernetes, rolling updates and rollbacks are built into Deployments. Here’s the practical setup and how to use them.

1) Use a Deployment

Rolling updates only work automatically when your app is managed by a Deployment (not a bare Pod).

Example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 3
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: nginx:1.25
          ports:
            - containerPort: 80

2) How rolling updates work

When you change the container image or pod template, Kubernetes gradually replaces old Pods with new ones.

Important fields:

  • maxUnavailable: how many Pods can be down during the update
  • maxSurge: how many extra Pods can be created above desired replicas during the update

Example meaning:

  • replicas: 3
  • maxUnavailable: 1
  • maxSurge: 1

Kubernetes can temporarily have up to 4 Pods, while ensuring at least 2 remain available.

3) Trigger an update

Update the image in the Deployment:

kubectl set image deployment/my-app my-app=nginx:1.26

Or edit the YAML and apply it:

kubectl apply -f deployment.yaml

4) Watch the rollout

Check rollout status:

kubectl rollout status deployment/my-app

See rollout history:

kubectl rollout history deployment/my-app

View details of a specific revision:

kubectl rollout history deployment/my-app --revision=2

5) Roll back to a previous version

If the new version is bad, roll back:

kubectl rollout undo deployment/my-app

That reverts to the previous revision.

To roll back to a specific revision:

kubectl rollout undo deployment/my-app --to-revision=2

6) Make rollbacks possible

Keep revision history with:

revisionHistoryLimit: 10

This tells Kubernetes to retain old ReplicaSets so you can undo to them later.

7) Best practices

  • Add readiness probes so traffic only goes to healthy Pods
  • Use liveness probes to restart stuck containers
  • Set resource requests/limits
  • Keep maxUnavailable low for availability
  • Test updates in staging before production

Example probes:

readinessProbe:
  httpGet:
    path: /health
    port: 80
  initialDelaySeconds: 5
  periodSeconds: 10

livenessProbe:
  httpGet:
    path: /health
    port: 80
  initialDelaySeconds: 15
  periodSeconds: 20

8) Optional: pause and resume rollouts

Pause a rollout:

kubectl rollout pause deployment/my-app

Resume:

kubectl rollout resume deployment/my-app

Useful if you want to make multiple changes without triggering intermediate rollouts.

If you want, I can also give you:

  • a full working Deployment YAML with probes and update strategy, or
  • a step-by-step demo showing update and rollback commands.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.