Skip to content

Commit 6f7f981

Browse files
authored
Merge pull request #30547 from josephburnett/hpa-v2
Revise HPA documentation for stable HPA v2 API
2 parents 1922a3d + ee39fdc commit 6f7f981

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ Autoscaling the replicas may take a few minutes.
184184
## Autoscaling on multiple metrics and custom metrics
185185

186186
You can introduce additional metrics to use when autoscaling the `php-apache` Deployment
187-
by making use of the `autoscaling/v2beta2` API version.
187+
by making use of the `autoscaling/v2` API version.
188188

189-
First, get the YAML of your HorizontalPodAutoscaler in the `autoscaling/v2beta2` form:
189+
First, get the YAML of your HorizontalPodAutoscaler in the `autoscaling/v2` form:
190190

191191
```shell
192192
kubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml
@@ -195,7 +195,7 @@ kubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml
195195
Open the `/tmp/hpa-v2.yaml` file in an editor, and you should see YAML which looks like this:
196196

197197
```yaml
198-
apiVersion: autoscaling/v2beta2
198+
apiVersion: autoscaling/v2
199199
kind: HorizontalPodAutoscaler
200200
metadata:
201201
name: php-apache
@@ -287,7 +287,7 @@ For example, if you had your monitoring system collecting metrics about network
287287
you could update the definition above using `kubectl edit` to look like this:
288288

289289
```yaml
290-
apiVersion: autoscaling/v2beta2
290+
apiVersion: autoscaling/v2
291291
kind: HorizontalPodAutoscaler
292292
metadata:
293293
name: php-apache
@@ -411,7 +411,7 @@ access to any metric, so cluster administrators should take care when exposing i
411411

412412
## Appendix: Horizontal Pod Autoscaler Status Conditions
413413

414-
When using the `autoscaling/v2beta2` form of the HorizontalPodAutoscaler, you will be able to see
414+
When using the `autoscaling/v2` form of the HorizontalPodAutoscaler, you will be able to see
415415
*status conditions* set by Kubernetes on the HorizontalPodAutoscaler. These status conditions indicate
416416
whether or not the HorizontalPodAutoscaler is able to scale, and whether or not it is currently restricted
417417
in any way.

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ or the custom metrics API (for all other metrics).
6262

6363
* For object metrics and external metrics, a single metric is fetched, which describes
6464
the object in question. This metric is compared to the target
65-
value, to produce a ratio as above. In the `autoscaling/v2beta2` API
65+
value, to produce a ratio as above. In the `autoscaling/v2` API
6666
version, this value can optionally be divided by the number of Pods before the
6767
comparison is made.
6868

@@ -161,18 +161,17 @@ fluctuating metric values.
161161

162162
## API Object
163163

164-
The Horizontal Pod Autoscaler is an API resource in the Kubernetes `autoscaling` API group.
165-
The current stable version, which only includes support for CPU autoscaling,
166-
can be found in the `autoscaling/v1` API version.
167-
168-
The beta version, which includes support for scaling on memory and custom metrics,
169-
can be found in `autoscaling/v2beta2`. The new fields introduced in `autoscaling/v2beta2`
170-
are preserved as annotations when working with `autoscaling/v1`.
164+
The Horizontal Pod Autoscaler is an API resource in the Kubernetes
165+
`autoscaling` API group. The current stable version can be found in
166+
the `autoscaling/v2` API version which includes support for scaling on
167+
memory and custom metrics. The new fields introduced in
168+
`autoscaling/v2` are preserved as annotations when working with
169+
`autoscaling/v1`.
171170

172171
When you create a HorizontalPodAutoscaler API object, make sure the name specified is a valid
173172
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
174173
More details about the API object can be found at
175-
[HorizontalPodAutoscaler Object](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#horizontalpodautoscaler-v1-autoscaling).
174+
[HorizontalPodAutoscaler Object](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#horizontalpodautoscaler-v2-autoscaling).
176175

177176

178177
## Support for Horizontal Pod Autoscaler in kubectl
@@ -299,7 +298,7 @@ the old container name from the HPA specification.
299298

300299
## Support for multiple metrics
301300

302-
Kubernetes 1.6 adds support for scaling based on multiple metrics. You can use the `autoscaling/v2beta2` API
301+
Kubernetes 1.6 adds support for scaling based on multiple metrics. You can use the `autoscaling/v2` API
303302
version to specify multiple metrics for the Horizontal Pod Autoscaler to scale on. Then, the Horizontal Pod
304303
Autoscaler controller will evaluate each metric, and propose a new scale based on that metric. The largest of the
305304
proposed scales will be used as the new scale.
@@ -313,9 +312,11 @@ custom metrics is still available, these metrics will not be available for use b
313312
annotations for specifying which custom metrics to scale on are no longer honored by the Horizontal Pod Autoscaler controller.
314313
{{< /note >}}
315314

316-
Kubernetes 1.6 adds support for making use of custom metrics in the Horizontal Pod Autoscaler.
317-
You can add custom metrics for the Horizontal Pod Autoscaler to use in the `autoscaling/v2beta2` API.
318-
Kubernetes then queries the new custom metrics API to fetch the values of the appropriate custom metrics.
315+
You can also use a HorizontalPodAutoscaler to change the scale of a
316+
workload based on custom metrics. You can add custom metrics for the
317+
Horizontal Pod Autoscaler to use in the `autoscaling/v2` API.
318+
Kubernetes then queries the new custom metrics API to fetch the values
319+
of the appropriate custom metrics.
319320

320321
See [Support for metrics APIs](#support-for-metrics-apis) for the requirements.
321322

@@ -349,12 +350,14 @@ and [the walkthrough for using external metrics](/docs/tasks/run-application/hor
349350

350351
Starting from
351352
[v1.18](https://github.com/kubernetes/enhancements/blob/master/keps/sig-autoscaling/853-configurable-hpa-scale-velocity/README.md)
352-
the `v2beta2` API allows scaling behavior to be configured through the HPA
353-
`behavior` field. Behaviors are specified separately for scaling up and down in
354-
`scaleUp` or `scaleDown` section under the `behavior` field. A stabilization
355-
window can be specified for both directions which prevents the flapping of the
356-
number of the replicas in the scaling target. Similarly specifying scaling
357-
policies controls the rate of change of replicas while scaling.
353+
the `v2beta2` API (and from v1.23 the `v2` API) allows scaling
354+
behavior to be configured through the HPA `behavior` field. Behaviors
355+
are specified separately for scaling up and down in `scaleUp` or
356+
`scaleDown` section under the `behavior` field. A stabilization window
357+
can be specified for both directions which prevents the flapping of
358+
the number of the replicas in the scaling target. Similarly specifying
359+
scaling policies controls the rate of change of replicas while
360+
scaling.
358361

359362
### Scaling Policies
360363

0 commit comments

Comments
 (0)