Post

Deployments

Kubernetes Deployments: how to update container images and view rollout history using kubectl.

The kubectl set image command updates the container image for a deployment. Using --dry-run=server lets you validate the change without applying it, and --record annotates the rollout history with the command that triggered each revision. You can then inspect the revision history with kubectl rollout history.

1
2
3
4
5
6
7
8
kubectl set image deployment/frontend *=kodekloud/webapp-color:v2 --dry-run=server --record

controlplane $ kubectl  rollout history deployment frontend
deployment.apps/frontend
REVISION  CHANGE-CAUSE
1         <none>
2         kubectl set image deployment/frontend *=kodekloud/webapp-color:v2 --record=true

This post is licensed under CC BY 4.0 by the author.