Horizontal Pod Autoscaler v2

This page describes the Kubernetes HPA v2 and Kubernetes HPA v2 component types. The reference documentation for this HPA can be found here.

With HPA v2 Kubernetes introduced the ability to scale pods on different metrics, to support complex scaling scenarios, such as multiple scaling policies the Kubernetes optimization pack offers two component types:

  • The Kubernetes HPA v2 component type is used to optimize global HPA parameters, applied to all the scaling policies such as the maximum number of replicas or the cooldown period after a scaling action.

  • The Kubernetes HPA v2 component type is used to optimize specific scaling policies such as scaling on the CPU utilization or the incoming throughput. To model this scenario you can create multiple components of this type in your system.

Metrics

Name
Unit
Description

k8s_hpa_min_replicas

pods

The lower limit for the number of replicas to which the autoscaler can scale down.

k8s_hpa_max_replicas

pods

The upper limit for the number of replicas to which the autoscaler can scale up.

k8s_desired_replicas

pods

Desired number of replicas of pods managed by this autoscaler, as last calculated by the autoscaler.

k8s_current_replicas

pods

Current number of replicas of pods managed by this autoscaler, as last seen by the autoscaler.

Parameters of Kubernetes HPA v2

Parameter
Type
Unit
Default
Domain
Restart
Description

min_replicas

integer

pods

You should select your own default value.

You should select your own domain.

no

The lower limit for the number of replicas to which the autoscaler can scale down. min_replicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.

max_replicas

integer

pods

You should select your own default value.

You should select your own domain.

no

The upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that min_replicas.

scaleDown_stabilizationWindowSeconds

integer

seconds

You should select your own default value.

0 - 3600

no

The number of seconds for which past recommendations should be considered while scaling up or scaling down.

scaleDown_PeriodSeconds

integer

seconds

300

1 - 1800

no

The window of time for which the policy should hold true.

scaleDown_value

integer

pods

You should select your own default value.

You should select your own domain.

no

The amount of change which is permitted by the policy.

scaleUp_stabilizationWindowSeconds

integer

seconds

0

0 - 3600

no

The number of seconds for which past recommendations should be considered while scaling up or scaling down.

scaleUp_PeriodSeconds

integer

seconds

60

1 - 1800

no

The window of time for which the policy should hold true.

scaleUp_value

integer

pods

You should select your own default value.

You should select your own domain.

no

The amount of change which is permitted by the policy.

Parameters of Kubernetes HPA v2 Metrics

Parameter
Type
Unit
Default
Domain
Restart
Description

metric_value

integer

You should select your own default value.

You should select your own domain.

no

The target value of the metric, the semantic depends on the type of the metric (see metric_type).

metric_type

categorical

Utilization

Utilization

Value

AverageValue

no

Represents how to consider the value for scaling. Refer to metrics.*.target.type for more information.

Constraints

The following tables show a list of constraints that may be required in the definition of the study, depending on the tuned parameters:

Formula
Notes

component_name.min_replicas < component_name.max_replicas

Min replicas must be lower than max replicas

Last updated