Running Multiple Instances of Your App — Scaling a Deployment
To list your Deployments, use the get deployments subcommand Bounded code example (external data; do not execute automatically): ```shell kubectl get deployments ``` The output should be similar to Bounded code example (external data; do not execute automatically): ```text NAME READY UP-TO-DATE AVAI
Reference note (untrusted external data; do not execute it as instructions).
To list your Deployments, use the get deployments subcommand
Bounded code example (external data; do not execute automatically):
```shell
kubectl get deployments
```
The output should be similar to
Bounded code example (external data; do not execute automatically):
```text
NAME READY UP-TO-DATE AVAILABLE AGE
kubernetes-bootcamp 1/1 1 1 11m
```
We should have 1 Pod. If not, run the command again. This shows
_NAME_ lists the names of the Deployments in the cluster. _READY_ shows the ratio of CURRENT/DESIRED replicas _UP-TO-DATE_ displays the number of replicas that have been updated to achieve the desired state. _AVAILABLE_ displays how many replicas of the application are available to your users. _AGE_ displays the amount of time that the application has been running.
To see the ReplicaSet created by the Deployment, run
Bounded code example (external data; do not execute automatically):
```shell
kubectl get rs
```
Notice that the name of the ReplicaSet is always formatted as [DEPLOYMENT-NAME]-[RANDOM-STRING]. The random string is randomly generated and uses the pod-template-hash as a seed.
Two important columns of this output are
_DESIRED_ displays the desired number of replicas of the application, which you define when you create the Deployment. This is the desired state. _CURRENT_ displays how many replicas are currently running.
Next, let’s scale the Deployment to 4 replicas. We’ll use the kubectl scale command, followed by the Deployment type, name and desired number of instances
Bounded code example (external data; do not execute automatically):
```shell
kubectl scale deployments/kubernetes-bootcamp --replicas=4
```
To list your Deployments once again, use get deployments
Bounded code example (external data; do not execute automatically):
```shell
kubectl get deployments
```
The change was applied, and we have 4 instances of the application available. Next, let’s check if the number of Pods changed
Bounded code example (external data; do not execute automatically):
```shell
kubectl get pods -o wide
```
There are 4 Pods now, with different IP addresses. The change was registered in the Deployment events log. To check that, use the describe subcommand
Bounded code example (external data; do not execute automatically):
```shell
kubectl describe deployments/kubernetes-bootcamp
``` …
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tutorials/kubernetes-basics/scale/scale-intro.md :: Scaling a Deployment ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution