horizontalPodAutoscalers parameter
Use the horizontalPodAutoscalers parameter to define a list of the
Horizontal Pod Autoscalers (HPAs) to automatically manage the number of pods in the deployment,
based on the observed CPU or custom metric utilization.
- The
horizontalPodAutoscalersenables horizontal pod scaling and assigns it to a deployment. The Operator does not perform scaling. You cannot usehorizontalPodAutoscalerswith an existing HPA. - The
horizontalPodAutoscalersmust be created by the Operator. The names of the HPAs that are shown in the following YAML are not the actual names for HPAs but logical names that are assigned by the Operator. - If the Horizontal Pod Autoscaler (HPA) is defined and the annotation
apps.oms.ibm.com/auto-managedisyes, then the Operator gives the replica count control to the HPA and updates the corresponding custom resource instances with the replica in the deployments. For more information about theapps.oms.ibm.com/auto-managedannotation, see Annotations used in Sterling Order Management System Operator .
The following YAML snippet is a sample schema of horizontalPodAutoscalers:
horizontalPodAutoscalers:
- name: Hpa1
maxReplicas: 1
minReplicas: 1
metrics:
- resource:
name: cpu
target:
averageUtilization: 1
type: Utilization
type: Resource
- name: Hpa2
maxReplicas: 5
minReplicas: 2
metrics:
- resource:
name: cpu
target:
averageUtilization: 5
type: Utilization
type: Resource
The following table explains the attributes applicable for the
For more information about configuring the metrics for the HPA, see Horizontal Pod Autoscaling.
horizontalPodAutoscalers parameter of OMEnvironment.
| Property | Default value | Value type | Required | Description |
|---|---|---|---|---|
name |
string | No | Specify the name of the Horizontal Pod Autoscaler. | |
behavior |
object | No | Specify the behavior of the target to scale upwards or downwards by using
scaleUp and scaleDown fields. If the behavior is not set, the
default HPA scaling rules for scaling up and scaling down are used. |
|
maxReplicas |
integer | No | Specify the maximum limit for the number of replicas to which the HPA can scale up. It cannot
be less than minReplicas. |
|
minReplicas |
integer | No | Specify the minimum limit for the number of replicas to which the HPA can scale down. It defaults to 1 pod. Scaling is active until at least one metric value is available. | |
metrics |
array | No | Specify the metrics details for calculating the replica count. The maximum replica count across all metrics is used. This calculation involves multiplying the ratio between the target value and the current value by the current number of pods. Therefore, the specified metrics decrease as the pod count increases, and vice-versa. For more information about how each specific metric type behaves, see individual metric source types. If the metrics are not set, the system defaults to configuring it to maintain an average CPU utilization of 80%. |