preloader
image Reading time: 1 minute

Kubernetes Scaling

Kubernetes Scaling Pods

Scaling on the fly is one of the most desired aspects of cloud deployments. With Kubernetes, you may change the number of pods without affecting services. The following two options are available to us. One is a straightforward command, while the other calls for configuration updates. Both are quite simple and logical. You would use the following command to scale a running deployment up to 4 pods:

kubectl scale deployment nginx-deployment --replicas=4

The second way is by configuring the YAML. To make the changes and apply to the existing deployment, complete the following:Edit the YAML as follows:

apiVersion: apps/v1beta2
kind: Deployment
metadata:
   name: nginx-deployment
spec:
   selector:
      matchLabels:
         app: nginx
   replicas: 4
   template:
      metadata:
          labels:
             app: nginx
     spec:
        containers:
        – name: nginx
           image: nginx
           ports:
           – containerPort: 80

Run this command:

kubectl -f apply nginx-deployment

Changes made using the first method would be undone during a reboot. The second choice is persistent and would endure a reset.

Share on: