HPA metric target types¶
In the context of the Kubernetes Horizontal Pod Autoscaler (HPA), metric target types define the specific value or calculation method used as the threshold to trigger scaling actions^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. These types are specified within the target field of a metric configuration in the HPA manifest.
The available target types depend on the source of the metric (e.g., Resource vs. Pods) and determine whether the autoscaler compares the metric against a raw quantity, an average across pods, or a percentage of a request^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md].
Target Types¶
Utilization¶
Type: Utilization
This type represents the target value as a percentage of the resource request value specified for a Pod^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md].
- Applicability: This type is currently valid only for metric sources of type
Resource(such as CPU or Memory)^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. - Configuration: It is set using the
averageUtilizationparameter^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. - Example: An
averageUtilizationof 50 means the HPA will aim to keep the average resource usage at 50% of the requested CPU.
AverageValue¶
Type: AverageValue
This type defines a target value as a quantity (e.g., 1k, 30), which represents the average of the metric across all relevant Pods^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md].
- Applicability: It is used with metric sources that can be averaged across the target Pods, such as
PodsandExternal^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. - Configuration: It is set using the
averageValueparameter^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. - Example: A target of
averageValue: 1kfor apackets-per-secondmetric would scale the deployment to maintain an average of 1,000 packets per second per Pod (assuming the metric is defined per pod).
Value¶
Type: Value
This type defines a specific target quantity (e.g., 10k) that is compared directly against the metric value^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md].
- Applicability: It is typically used with the
Objectmetric source, where the metric describes a single Kubernetes object (like an Ingress) rather than an average of Pod metrics^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. - Configuration: It is set using the
valueparameter^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]. - Example: Scaling a Deployment based on an Ingress metric where the target is
value: 10krequests per second.
Metric Source Mapping¶
The relationship between metric sources and their compatible target types can be summarized as follows^[400-devops__06-Kubernetes__k8s-ithelp__Day26__README.md]:
- Resource: Supports
Utilization(set viaaverageUtilization). - Pods: Supports
AverageValue(set viaaverageValue). - Object: Supports
Value(set viavalue). - External: Supports
AverageValue(set viaaverageValue).
Related Concepts¶
- [[kubernetes-hpa|Kubernetes HPA]]
- Metrics Server
- [[autoscaling|Autoscaling]]