Kubectl Scale Command Usage in Kubernetes

Itacen Sabacok | May 14, 2022

Set a new size for a deployment, replica set, replication controller, or stateful set.

 1# syntax
 2kubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)  
 3
 4# Scale stateful set named 'ui' to 2
 5kubectl scale --replicas=2 statefulset/ui
 6
 7# Scale a replica set named 'foo' to 3
 8kubectl scale --replicas=3 rs/foo
 9
10# Scale a resource identified by type and name specified in "foo.yaml" to 4
11kubectl scale --replicas=4 -f foo.yaml
12
13# Scale multiple replication controllers
14kubectl scale --replicas=5 rc/foo rc/bar rc/baz