Scaling Kubernetes applications
The ReplicaSet resource in Kubernetes ensures that a specified number of application Pod replicas are running as part of the Deployment. This mechanism will help to scale the application horizontally whenever needed and without additional resource configurations. A ReplicaSet resource will be created when you create a deployment resource in Kubernetes, as shown in Figure 11.28:
Figure 11.28 – A ReplicaSet resource created as part of Deployment
Specify the initial number of replicas inside the Deployment definition file as replicas: 1
. ReplicaSet will scale the number of Pods based on the replica number.
When there is extra traffic on the application Pods, scale the application using the kubectl scale
command, as follows (modify the Deployment, not the ReplicaSet):
Figure 11.29 – Scaling an application using kubectl
Wait for the replication changes to take effect and check the resource...