Scaling pods:

As users increase, the load on the systems increase also. To keep the systems running smoothly, we could add more pods to manage the increasing load.

If the Yaml file of our replicaSet looks like below:


We could increase the number of the pods using the below command to go from "2" replicas to "6" replicas:


Using a Yaml file to scale the pods:

The above command scales the pods to "6" replicas, but if for any reason, we update the above Yaml file of our replicaSet, and run the below command:


The number of replicas will go back to "2". 

To keep that from happening, we would need to change the number of replicas in the Yaml file as shown below:


Then we would need to run the below command for the changes to take effect:


Autoscaling pods:

In some cases, we just have an approximate idea of the number of pods and resource consumption 
we would need for certain environments.

Example:

If we want to have between "2" to "6" replicas of a pod without going above "55%" of the CPU resources, we would use the below command:


Remark:

We either use the auto-scaler ( example above ) or aYaml file for stating the wanted number of replicas.

We could also use a Yaml file for creating an autoscaler:


We can then create it using the below command:


Deleting the replicaSet:

To delete the replicaSet we use the below command:


This also deletes the pods "attached" to the replicaSet.

To only delete the replicaSet and keep the pods attached to it, we add the "--cascade=orphan" option to the above command.
Brando Sabatini and Ikbal C ©. Powered by Blogger.