Kubernetes `Rollout`
November 14, 2024
note-to-self
k8s
In k8s, you don't "deploy", you "rollout". But, you don't "rollout" either. You either apply a deployment (or do it through helm, preferably), or kubectl create deployment <name>. But really, do it through helm won't ya?
Apply the Deployment or Update:
- When you want to deploy an application or update it, you use
kubectl apply -f <file>orkubectl create deployment <name>, or use helmhelm install <release-name> <chart> - This action creates or updates the resources, which automatically starts a rollout.
- When you want to deploy an application or update it, you use
Manage the Rollout with
kubectl rolloutCommands:- After starting the deployment (or update), you use
kubectl rolloutcommands to manage or observe the rollout's progress:- Check status with
kubectl rollout status deployment <deployment-name>to ensure the update is progressing without issues. - Undo the rollout with
kubectl rollout undo deployment <deployment-name>if you need to roll back to the previous version. - Pause or resume the rollout with
kubectl rollout pauseorkubectl rollout resumeif you need to halt changes temporarily.
- Check status with
- After starting the deployment (or update), you use
Do it all with helm:
- helm install
(To "rollout") - helm list (To find the release name)
- helm history my-app (To see the revision history)
- helm rollback my-app 2 (To roll back to revision 2; ("rollback!"))
- helm status my-app (To verify the rollback)
- helm install
The way I understand it, kubectl apply/helm install initiates the rollout, while kubectl rollout/helm list/history/rollback/status commands help you manage the rollout and watch it progress.
Most posts are for my own reference and reflection, and shouldn’t be taken as fully accurate or instructional.