Scaling up and down

More copies, fewer copies, on demand.

Beginner8 min · lesson 9 of 24
In plain terms
Scaling is turning a dial: more customers, spin up more copies; a quiet night, spin some down. Same app, just more or fewer hands on deck.

Need more copies to handle more traffic? Scale. One command changes the desired number and the ReplicaSet quietly makes reality match — new pods appear, all identical, all sharing the load.

terminal
$ kubectl scale deployment web --replicas=5
$ kubectl get pods -l app=web
# two new pods appear alongside the original three
$ kubectl scale deployment web --replicas=2 # scale back down just as easily

Later you can have Kubernetes scale automatically based on load (the autoscaler), but manual scaling is the foundation, and it is often all a small app needs. Scaling changes how many copies run — it does not change the app itself.

Scaling needs a stateless app
Running five copies only works if any copy can handle any request. Apps that store data on local disk need more care (see the storage topics) — for a plain web server, scaling just works.