Rolling Update and Rollback a Deployment
Scenario
A Deployment named web-app is running in the production namespace with the image nginx:alpine. You need to update it to a new image using a controlled rolling update strategy, then roll back to the previous version and record the rollout history.
Task
A Deployment named web-app already exists in the production namespace. Update the image to httpd:trixie and configure the rolling update strategy with maxUnavailable: 1 and maxSurge: 1.
Once the rollout completes, roll back the Deployment to the previous revision and confirm the Pods are running nginx:alpine again.
Finally, check the rollout history to find which revision contains httpd:trixie, then save that revision's history output to:
/home/laborant/revision-history-httpd.txt
Hint 1
Use kubectl set image to update the image, kubectl patch to configure the rolling update strategy, and kubectl rollout undo to roll back. To find the revision containing httpd:trixie, use kubectl rollout history with --revision=<number>.
See the official docs: Deployment Rolling Update