What you will learn
- Create deployments
- Roll out and roll back
- Scale replicas
New to this? Start here
The basics, in plain English
You rarely manage Pods by hand. A Deployment is a manager that keeps the right number of identical Pods running, and rolls out new versions gradually so updates do not cause downtime.
- Deployment
- A controller that keeps N copies of your app running and handles updates.
- Replica
- One of the identical copies of your Pod running in parallel.
- Scaling
- Changing how many replicas run, up for more traffic or down to save money.
- Rolling update
- Replacing old Pods with new ones a few at a time, so the app never goes fully down.
- Rollback
- Instantly reverting to the previous version if a new one is broken.
01
Desired state
A Deployment manages ReplicaSets to keep N pods running and performs rolling updates. kubectl rollout undo reverts a bad release.
Try it yourself
bash
$kubectl apply -f deploy.yaml↳Create or update resources from the YAML file.$kubectl scale deploy/web --replicas=5↳Run 5 copies of the web deployment.$kubectl rollout status deploy/web↳Watch a deployment roll out until it is healthy.$kubectl rollout undo deploy/web↳Roll back to the previous version if something broke.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.