Scaling and updating
Change how many copies run, and move to a new version.
A Kubernetes practice simulator runs inside your browser tab. It behaves like the real commands for what the lessons teach, and it is labelled as a simulation.
Scaling up and down
kubectl scale changes the number of replicas. Kubernetes adds or removes pods until the number matches.
Scaling to 0 stops every pod but keeps the deployment, so you can scale back up later.
kubectl create deployment web --image=nginx
kubectl scale deployment web --replicas=4
kubectl get podsYour turn: handle more visitors
A deployment named web is running here with one replica.
Practice task
Scale the deployment web to 5 replicas.
Your answer is run and checked in the lesson. Create a free account to try it.
Moving to a new version
kubectl set image changes the image a deployment runs. You name the container, then the new image.
Kubernetes replaces the pods a few at a time, so the application stays available. This is called a rolling update.
kubectl rollout status tells you whether the update has finished.
kubectl create deployment web --image=nginx
kubectl set image deployment/web nginx=nginx:1.27
kubectl rollout status deployment/webYour turn: a new version
A deployment named web is running nginx here, with three replicas. Its container is named nginx.
Practice task
Update the deployment web to the image nginx:1.27. Keep the three replicas.
Your answer is run and checked in the lesson. Create a free account to try it.