Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernets update minReplicas and maxReplica

I am a newbie on Ops and need to update through Lens the HPA configuration like:

From:

  minReplicas: 6
  maxReplicas: 10

To:

  minReplicas: 4
  maxReplicas: 16

My doubt is if the PODs will be recreated or not once we have 8 instances running.

like image 919
Luciano Borges Avatar asked Nov 18 '25 21:11

Luciano Borges


1 Answers

In Kubernetes, a HorizontalPodAutoscaler automatically updates a workload resource (such as a Deployment or StatefulSet), with the aim of automatically scaling the workload to match demand.

The HorizontalPodAutoscaler is implemented as a Kubernetes API resource and a controller.

By configuring minReplicas and maxReplicas you are configuring the API resource.

In this case, the HPA controller does not recreate running pods. And it does not scale up/down the workload if the number of currently running replicas is within the new min/max.

The HPA controller then continues to monitor the load:

  • If the load decreases, and the number of Pods is above the configured minimum, the HorizontalPodAutoscaler instructs the workload resource (the Deployment, StatefulSet, or other similar resource) to scale down.
  • If the load increases, and the number of Pods is below the configured maximum, the HorizontalPodAutoscaler instructs the workload resource (the Deployment, StatefulSet, or other similar resource) to scale up.

See more info about Horizontal Pod Autoscaling here.

like image 75
mozello Avatar answered Nov 21 '25 15:11

mozello



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!