Skip to content

Commit a78bff6

Browse files
committed
Add AverageValue example for HPA resource metrics
- Added example showing how to use AverageValue target type - Clarified that AverageValue scales based on actual consumption - Addresses issue #53447
1 parent 0a29bbb commit a78bff6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

content/en/docs/tasks/run-application/horizontal-pod-autoscale.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,31 @@ When a `targetAverageValue` or `targetAverageUtilization` is specified,
149149
the `currentMetricValue` is computed by taking the average of the given
150150
metric across all Pods in the HorizontalPodAutoscaler's scale target.
151151

152+
**Example: Scaling based on raw resource values**
153+
154+
You can configure the HPA to scale based on actual resource consumption without depending
155+
on resource requests:
156+
```yaml
157+
type: Resource
158+
resource:
159+
name: cpu
160+
target:
161+
type: AverageValue
162+
averageValue: 100m
163+
---
164+
type: Resource
165+
resource:
166+
name: memory
167+
target:
168+
type: AverageValue
169+
averageValue: 512Mi
170+
```
171+
172+
With `AverageValue`, the HPA scales based on the actual measured resource consumption per
173+
pod, independent of any resource requests configured in the pod specification. For instance,
174+
if the average CPU usage across all pods is 200m and the target averageValue is 100m, the
175+
HPA will scale up according to the ratio (200m / 100m = 2.0).
176+
152177
Before checking the tolerance and deciding on the final values, the control
153178
plane also considers whether any metrics are missing, and how many Pods
154179
are [`Ready`](/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions).

0 commit comments

Comments
 (0)