Deployments
Versioned rollouts and rollback over ReplicaSets.
In plain terms
A Deployment is the store manager who rolls out the new uniform one cashier at a time — no one is ever left undressed — and if the new uniform turns out bad, instantly puts everyone back in the old one.
Old ReplicaSets are kept, so rollback is just scaling a prior revision back up.
A Deployment is the object you actually use for stateless apps. It manages ReplicaSets to give you versioned, zero-downtime rollouts and instant rollback — which is the entire reason for the indirection through ReplicaSets.
terminal
$ kubectl create deploy web --image=nginx:1.25 --replicas=3$ kubectl set image deploy/web nginx=nginx:1.26 # rolling update$ kubectl rollout status deploy/webdeployment "web" successfully rolled out$ kubectl rollout undo deploy/web # back to 1.25, instantly
A rollout creates a new ReplicaSet and shifts pods across gradually; old ReplicaSets are retained, so undo just scales a previous revision back up. The RollingUpdate strategy’s maxSurge and maxUnavailable control how aggressive that shift is — the knobs we tune in Application Lifecycle.
Rollback needs history
revisionHistoryLimit sets how many old ReplicaSets are kept (default 10). Set it to 0 and you keep a tidy cluster but lose the ability to roll back.