Skip to content

Commit 5a78a80

Browse files
authored
Merge pull request #51078 from lmktfy/20250526_tweak_hpa_task
Align HorizontalPodAutoscaler page to docs style guidance
2 parents 3183be9 + fb1ec5e commit 5a78a80

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ horizontal pod autoscaling.
5151
{{< mermaid >}}
5252
graph BT
5353

54-
hpa[Horizontal Pod Autoscaler] --> scale[Scale]
54+
hpa[HorizontalPodAutoscaler] --> scale[Scale]
5555

5656
subgraph rc[RC / Deployment]
5757
scale
@@ -170,12 +170,12 @@ determining whether to set aside certain CPU metrics. Instead, it
170170
considers a Pod "not yet ready" if it's unready and transitioned to
171171
ready within a short, configurable window of time since it started.
172172
This value is configured with the `--horizontal-pod-autoscaler-initial-readiness-delay`
173-
flag, and its default is 30 seconds.
173+
command line option, and its default is 30 seconds.
174174
Once a pod has become ready, it considers any transition to
175175
ready to be the first if it occurred within a longer, configurable time
176176
since it started. This value is configured with the
177-
`--horizontal-pod-autoscaler-cpu-initialization-period` flag, and its
178-
default is 5 minutes.
177+
`--horizontal-pod-autoscaler-cpu-initialization-period` command line option,
178+
and its default is 5 minutes.
179179

180180
The \\( currentMetricValue \over desiredMetricValue \\) base scale ratio is then
181181
calculated, using the remaining pods not set aside or discarded from above.
@@ -212,47 +212,49 @@ the current value.
212212

213213
Finally, right before HPA scales the target, the scale recommendation is recorded. The
214214
controller considers all recommendations within a configurable window choosing the
215-
highest recommendation from within that window. This value can be configured using the
216-
`--horizontal-pod-autoscaler-downscale-stabilization` flag, which defaults to 5 minutes.
215+
highest recommendation from within that window. You can configure this value using the
216+
`--horizontal-pod-autoscaler-downscale-stabilization` command line option, which defaults to 5 minutes.
217217
This means that scaledowns will occur gradually, smoothing out the impact of rapidly
218218
fluctuating metric values.
219219

220-
### Pod readiness and autoscaling metrics
220+
## Pod readiness and autoscaling metrics
221221

222-
The HorizontalPodAutoscaler (HPA) controller includes two flags that influence how CPU metrics are collected from Pods during startup:
222+
The HorizontalPodAutoscaler (HPA) controller includes two command line options that influence how CPU metrics are collected from Pods during startup:
223223

224224
1. `--horizontal-pod-autoscaler-cpu-initialization-period` (default: 5 minutes)
225225

226226
This defines the time window after a Pod starts during which its **CPU usage is ignored** unless:
227227
- The Pod is in a `Ready` state **and**
228228
- The metric sample was taken entirely during the period it was `Ready`.
229229

230-
This flag helps **exclude misleading high CPU usage** from initializing Pods (e.g., Java apps warming up) in HPA scaling decisions.
230+
This command line option helps **exclude misleading high CPU usage** from initializing Pods (for example: Java apps warming up) in HPA scaling decisions.
231231

232-
2. `--horizontal-pod-autoscaler-initial-readiness-delay` (default: 30 seconds)
232+
1. `--horizontal-pod-autoscaler-initial-readiness-delay` (default: 30 seconds)
233233

234234
This defines a short delay period after a Pod starts during which the HPA controller treats Pods that are currently `Unready` as still initializing, **even if they have previously transitioned to `Ready` briefly**.
235235

236236
It is designed to:
237237
- Avoid including Pods that rapidly fluctuate between `Ready` and `Unready` during startup.
238238
- Ensure stability in the initial readiness signal before HPA considers their metrics valid.
239239

240-
**Key behaviors:**
240+
241+
You can only set these command line options cluster-wide.
242+
243+
### Key behaviors for pod readiness {#pod-readiness-key-behaviors}
244+
241245
- If a Pod is `Ready` and remains `Ready`, it can be counted as contributing metrics even within the delay.
242246
- If a Pod rapidly toggles between `Ready` and `Unready`, metrics are ignored until it’s considered stably `Ready`.
243247

244-
#### Best Practice:
245-
246-
If your Pod has a startup phase with high CPU usage:
248+
### Good practice for pod readiness {#pod-readiness-good-practices}
247249

248250
- Configure a `startupProbe` that doesn't pass until the high CPU usage has passed, or
249251
- Ensure your `readinessProbe` only reports `Ready` **after** the CPU spike subsides, using `initialDelaySeconds`.
250252

251253
And ideally also set `--horizontal-pod-autoscaler-cpu-initialization-period` to **cover the startup duration**.
252254

253-
## API Object
255+
## API object
254256

255-
The Horizontal Pod Autoscaler is an API resource in the Kubernetes
257+
The HorizontalPodAutoscaler is an API kind in the Kubernetes
256258
`autoscaling` API group. The current stable version can be found in
257259
the `autoscaling/v2` API version which includes support for scaling on
258260
memory and custom metrics. The new fields introduced in
@@ -512,7 +514,7 @@ default can be updated for both scale-up and scale-down using the
512514
`--horizontal-pod-autoscaler-tolerance` command line argument. (You can't use the Kubernetes API
513515
to configure this default value.)
514516

515-
### Default Behavior
517+
### Default behavior
516518

517519
To use the custom scaling not all fields have to be specified. Only values which need to be
518520
customized can be specified. These custom values are merged with default values. The default values
@@ -538,7 +540,7 @@ behavior:
538540
selectPolicy: Max
539541
```
540542
For scaling down the stabilization window is _300_ seconds (or the value of the
541-
`--horizontal-pod-autoscaler-downscale-stabilization` flag if provided). There is only a single policy
543+
`--horizontal-pod-autoscaler-downscale-stabilization` command line option, if provided). There is only a single policy
542544
for scaling down which allows a 100% of the currently running replicas to be removed which
543545
means the scaling target can be scaled down to the minimum allowed replicas.
544546
For scaling up there is no stabilization window. When the metrics indicate that the target should be

0 commit comments

Comments
 (0)