Home > Net >  Kubernets update minReplicas and maxReplica
Kubernets update minReplicas and maxReplica

Time:04-01

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.

CodePudding user response:

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.

  • Related