LinuxCommandLibrary

kubectl-scale

sets a new size for a deployment, replica set, or replication controller

TLDR

Scale deployment replicas

$ kubectl scale deployment [name] --replicas=[3]
copy
Scale multiple deployments
$ kubectl scale deployment [name1] [name2] --replicas=[3]
copy
Scale with current replica check
$ kubectl scale deployment [name] --current-replicas=[2] --replicas=[3]
copy
Scale from file
$ kubectl scale -f [manifest.yaml] --replicas=[5]
copy

SYNOPSIS

kubectl scale type name --replicas=count [options]

DESCRIPTION

kubectl scale adjusts the replica count for deployments, replica sets, replication controllers, and stateful sets, allowing you to increase or decrease the number of running pod instances on demand. Changes take effect immediately, with the Kubernetes controller manager working to reconcile the actual state to the desired replica count.
The command supports a precondition flag (--current-replicas) that causes the scaling operation to fail if the current number of replicas does not match the expected value, which is useful for preventing race conditions in automated workflows. You can also scale resources defined in manifest files and apply the operation to multiple resources in a single invocation.

PARAMETERS

--replicas count

Target number of replicas.
--current-replicas count
Precondition for current replicas.
-f, --filename file
Resource file to scale.
--timeout duration
Timeout for scaling operation.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community