Scaling the application deployment
Changing the number of replicas in a Deployment allows scaling the deployments. When a Deployment is scaled out, new pods will be created and scheduled to Nodes with available resources. The number of pods will be scaled up to the new target state. Autoscaling pods is also supported by Kubernetes. It is also possible to scale to zero, which will terminate all pods in a given Deployment.
Running many instances of an application needs a method for distributing traffic among them. A built-in load balancer in a Services
object distributes network traffic across all pods in an exposed Deployment. Endpoints will be used to continuously monitor the operating pods, ensuring that traffic is only directed to those that are available.
We'll use a new YAML file to increase the number of pods in the Deployment in the following example. The replicas are set to 4
in this YAML file, indicating that the Deployment should include four pods:
apiVersion...