Kubernetes interview question · Most asked
How do rolling updates work in a Deployment, and how do you roll back?
Summary
A rolling update creates a new ReplicaSet and shifts pods from old to new gradually, limited by maxSurge (extra pods allowed above the desired count) and maxUnavailable (pods allowed to be unavailable). New pods only count as available once they pass readiness (and minReadySeconds). Roll back with kubectl rollout undo or, better, by reverting the manifest in Git.
Longer Answer
progressDeadlineSeconds marks a rollout as failed if it stalls (for example, new pods never become ready), but Kubernetes does not roll back automatically; tools such as Argo Rollouts or Flagger add automated canary analysis and rollback.
A rolling update only works safely when old and new versions can run side by side (backward-compatible APIs and database schema) and when readiness probes reflect real readiness. maxUnavailable: 0 with maxSurge: 25% keeps full capacity during the rollout at the cost of temporary extra pods.
Key Points
- New ReplicaSet scaled up, old scaled down.
- maxSurge / maxUnavailable control pace.
- Readiness gates progress.
- No automatic rollback; use undo, Git revert or Argo Rollouts.
More most-asked Kubernetes questions
- Describe the Kubernetes architecture: what runs on the control plane and what runs on the nodes?
- What is the difference between resource requests and limits, and what are the QoS classes?
- Deployment, StatefulSet, DaemonSet, Job and CronJob: when do you use each?
- Explain the Service types: ClusterIP, NodePort, LoadBalancer, ExternalName and headless.
- What happens, step by step, when you run kubectl apply for a Deployment?
- How does the scheduler place pods? Explain resource requests, node affinity, taints and tolerations.
- ConfigMaps and Secrets: how do they differ, and how should secrets really be handled?
- Liveness, readiness and startup probes: how do you configure them correctly?