Every change to spec.template is a rollout. The image is the usual change.
Start one
text
learner@shallows:~$ kubectl set image deploy/market-web nginx=nginx:1.26
deployment.apps/market-web image updateddeploy/market-webthe objectnginxcontainer name=nginx:1.26new image
The container name is nginx because create deploy named it after the image. Check with kubectl get deploy market-web -o yaml when unsure.
What happens
market-web-7676f9f845nginx:1.27, scaling down
Pods move
market-web-dcc45cf54nginx:1.26, scaling up
text
learner@shallows:~$ kubectl rollout status deploy/market-web
Waiting for deployment "market-web" rollout to finish: 1 out of 3 new replicas have been updated...
deployment "market-web" successfully rolled out
learner@shallows:~$ kubectl get rs
NAME DESIRED CURRENT READY AGE
market-web-7676f9f845 0 0 0 5m
market-web-dcc45cf54 3 3 3 20sThe old ReplicaSet stays at 0. It is the way back.
Record why
text
learner@shallows:~$ kubectl annotate deploy market-web kubernetes.io/change-cause="upgrade nginx to 1.26"
learner@shallows:~$ kubectl rollout history deploy/market-web
REVISION CHANGE-CAUSE
1 <none>
2 upgrade nginx to 1.26The CHANGE-CAUSE is an annotation. Set it before or right after the change, and the revision keeps it. rollout history --revision=2 prints that revision's template.