HorizontalPodAutoscalerSpec

io.k8s.api.autoscaling.v2.HorizontalPodAutoscalerSpec source ↗

HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.

behaviorHorizontalPodAutoscalerBehaviorbehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used.
scaleDownHPAScalingRulesscaleDown is scaling policy for scaling Down. If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used).
policies[]HPAScalingPolicypolicies is a list of potential scaling polices which can be used during scaling. If not set, use the default values: - For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window. - For scale down: allow all pods to be removed in a 15s window.
periodSecondsinteger (int32) requiredperiodSeconds specifies the window of time for which the policy should hold true. PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).
typestring requiredtype is used to specify the scaling policy.
valueinteger (int32) requiredvalue contains the amount of change which is permitted by the policy. It must be greater than zero
selectPolicystringselectPolicy is used to specify which policy should be used. If not set, the default value Max is used.
stabilizationWindowSecondsinteger (int32)stabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long).
toleranceQuantitytolerance is the tolerance on the ratio between the current and desired metric value under which no updates are made to the desired number of replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not set, the default cluster-wide tolerance is applied (by default 10%).For example, if autoscaling is configured with a memory consumption target of 100Mi, and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be triggered when the actual consumption falls below 95Mi or exceeds 101Mi.This is an alpha field and requires enabling the HPAConfigurableTolerance feature gate.
scaleUpHPAScalingRulesscaleUp is scaling policy for scaling Up. If not set, the default value is the higher of:
  • increase no more than 4 pods per 60 seconds
  • double the number of pods per 60 seconds
No stabilization is used.
policies[]HPAScalingPolicypolicies is a list of potential scaling polices which can be used during scaling. If not set, use the default values: - For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window. - For scale down: allow all pods to be removed in a 15s window.
periodSecondsinteger (int32) requiredperiodSeconds specifies the window of time for which the policy should hold true. PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).
typestring requiredtype is used to specify the scaling policy.
valueinteger (int32) requiredvalue contains the amount of change which is permitted by the policy. It must be greater than zero
selectPolicystringselectPolicy is used to specify which policy should be used. If not set, the default value Max is used.
stabilizationWindowSecondsinteger (int32)stabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long).
toleranceQuantitytolerance is the tolerance on the ratio between the current and desired metric value under which no updates are made to the desired number of replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not set, the default cluster-wide tolerance is applied (by default 10%).For example, if autoscaling is configured with a memory consumption target of 100Mi, and scale-down and scale-up tolerances of 5% and 1% respectively, scaling will be triggered when the actual consumption falls below 95Mi or exceeds 101Mi.This is an alpha field and requires enabling the HPAConfigurableTolerance feature gate.
maxReplicasinteger (int32) requiredmaxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas.
metrics[]MetricSpecmetrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.
containerResourceContainerResourceMetricSourcecontainerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
containerstring requiredcontainer is the name of the container in the pods of the scaling target
namestring requiredname is the name of the resource in question.
targetMetricTarget requiredtarget specifies the target value for the given metric
averageUtilizationinteger (int32)averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type
averageValueQuantityaverageValue is the target value of the average of the metric across all relevant pods (as a quantity)
typestring requiredtype represents whether the metric type is Utilization, Value, or AverageValue
valueQuantityvalue is the target value of the metric (as a quantity).
externalExternalMetricSourceexternal refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
metricMetricIdentifier requiredmetric identifies the target metric by name and selector
namestring requiredname is the name of the given metric
selectorLabelSelectorselector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.
matchExpressions[]LabelSelectorRequirementmatchExpressions is a list of label selector requirements. The requirements are ANDed.
keystring requiredkey is the label key that the selector applies to.
operatorstring requiredoperator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
values[]stringvalues is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
matchLabelsmap[string]stringmatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
targetMetricTarget requiredtarget specifies the target value for the given metric
averageUtilizationinteger (int32)averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type
averageValueQuantityaverageValue is the target value of the average of the metric across all relevant pods (as a quantity)
typestring requiredtype represents whether the metric type is Utilization, Value, or AverageValue
valueQuantityvalue is the target value of the metric (as a quantity).
objectObjectMetricSourceobject refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).
describedObjectCrossVersionObjectReference requireddescribedObject specifies the descriptions of a object,such as kind,name apiVersion
apiVersionstringapiVersion is the API version of the referent
namestring requiredname is the name of the referent;More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
metricMetricIdentifier requiredmetric identifies the target metric by name and selector
namestring requiredname is the name of the given metric
selectorLabelSelectorselector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.
matchExpressions[]LabelSelectorRequirementmatchExpressions is a list of label selector requirements. The requirements are ANDed.
keystring requiredkey is the label key that the selector applies to.
operatorstring requiredoperator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
values[]stringvalues is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
matchLabelsmap[string]stringmatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
targetMetricTarget requiredtarget specifies the target value for the given metric
averageUtilizationinteger (int32)averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type
averageValueQuantityaverageValue is the target value of the average of the metric across all relevant pods (as a quantity)
typestring requiredtype represents whether the metric type is Utilization, Value, or AverageValue
valueQuantityvalue is the target value of the metric (as a quantity).
podsPodsMetricSourcepods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.
metricMetricIdentifier requiredmetric identifies the target metric by name and selector
namestring requiredname is the name of the given metric
selectorLabelSelectorselector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.
matchExpressions[]LabelSelectorRequirementmatchExpressions is a list of label selector requirements. The requirements are ANDed.
keystring requiredkey is the label key that the selector applies to.
operatorstring requiredoperator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
values[]stringvalues is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
matchLabelsmap[string]stringmatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
targetMetricTarget requiredtarget specifies the target value for the given metric
averageUtilizationinteger (int32)averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type
averageValueQuantityaverageValue is the target value of the average of the metric across all relevant pods (as a quantity)
typestring requiredtype represents whether the metric type is Utilization, Value, or AverageValue
valueQuantityvalue is the target value of the metric (as a quantity).
resourceResourceMetricSourceresource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
namestring requiredname is the name of the resource in question.
targetMetricTarget requiredtarget specifies the target value for the given metric
averageUtilizationinteger (int32)averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type
averageValueQuantityaverageValue is the target value of the average of the metric across all relevant pods (as a quantity)
typestring requiredtype represents whether the metric type is Utilization, Value, or AverageValue
valueQuantityvalue is the target value of the metric (as a quantity).
typestring requiredtype is the type of metric source. It should be one of "ContainerResource", "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object.
minReplicasinteger (int32)minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas 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.
scaleTargetRefCrossVersionObjectReference requiredscaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count.
apiVersionstringapiVersion is the API version of the referent
namestring requiredname is the name of the referent;More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names