Merge pull request #30547 from josephburnett/hpa-v2
Revise HPA documentation for stable HPA v2 APIpull/30709/head
commit
6f7f9810b0
|
@ -184,9 +184,9 @@ Autoscaling the replicas may take a few minutes.
|
||||||
## Autoscaling on multiple metrics and custom metrics
|
## Autoscaling on multiple metrics and custom metrics
|
||||||
|
|
||||||
You can introduce additional metrics to use when autoscaling the `php-apache` Deployment
|
You can introduce additional metrics to use when autoscaling the `php-apache` Deployment
|
||||||
by making use of the `autoscaling/v2beta2` API version.
|
by making use of the `autoscaling/v2` API version.
|
||||||
|
|
||||||
First, get the YAML of your HorizontalPodAutoscaler in the `autoscaling/v2beta2` form:
|
First, get the YAML of your HorizontalPodAutoscaler in the `autoscaling/v2` form:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get hpa php-apache -o yaml > /tmp/hpa-v2.yaml
|
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
|
||||||
Open the `/tmp/hpa-v2.yaml` file in an editor, and you should see YAML which looks like this:
|
Open the `/tmp/hpa-v2.yaml` file in an editor, and you should see YAML which looks like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: autoscaling/v2beta2
|
apiVersion: autoscaling/v2
|
||||||
kind: HorizontalPodAutoscaler
|
kind: HorizontalPodAutoscaler
|
||||||
metadata:
|
metadata:
|
||||||
name: php-apache
|
name: php-apache
|
||||||
|
@ -287,7 +287,7 @@ For example, if you had your monitoring system collecting metrics about network
|
||||||
you could update the definition above using `kubectl edit` to look like this:
|
you could update the definition above using `kubectl edit` to look like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: autoscaling/v2beta2
|
apiVersion: autoscaling/v2
|
||||||
kind: HorizontalPodAutoscaler
|
kind: HorizontalPodAutoscaler
|
||||||
metadata:
|
metadata:
|
||||||
name: php-apache
|
name: php-apache
|
||||||
|
@ -411,7 +411,7 @@ access to any metric, so cluster administrators should take care when exposing i
|
||||||
|
|
||||||
## Appendix: Horizontal Pod Autoscaler Status Conditions
|
## Appendix: Horizontal Pod Autoscaler Status Conditions
|
||||||
|
|
||||||
When using the `autoscaling/v2beta2` form of the HorizontalPodAutoscaler, you will be able to see
|
When using the `autoscaling/v2` form of the HorizontalPodAutoscaler, you will be able to see
|
||||||
*status conditions* set by Kubernetes on the HorizontalPodAutoscaler. These status conditions indicate
|
*status conditions* set by Kubernetes on the HorizontalPodAutoscaler. These status conditions indicate
|
||||||
whether or not the HorizontalPodAutoscaler is able to scale, and whether or not it is currently restricted
|
whether or not the HorizontalPodAutoscaler is able to scale, and whether or not it is currently restricted
|
||||||
in any way.
|
in any way.
|
||||||
|
|
|
@ -62,7 +62,7 @@ or the custom metrics API (for all other metrics).
|
||||||
|
|
||||||
* For object metrics and external metrics, a single metric is fetched, which describes
|
* For object metrics and external metrics, a single metric is fetched, which describes
|
||||||
the object in question. This metric is compared to the target
|
the object in question. This metric is compared to the target
|
||||||
value, to produce a ratio as above. In the `autoscaling/v2beta2` API
|
value, to produce a ratio as above. In the `autoscaling/v2` API
|
||||||
version, this value can optionally be divided by the number of Pods before the
|
version, this value can optionally be divided by the number of Pods before the
|
||||||
comparison is made.
|
comparison is made.
|
||||||
|
|
||||||
|
@ -161,18 +161,17 @@ fluctuating metric values.
|
||||||
|
|
||||||
## API Object
|
## API Object
|
||||||
|
|
||||||
The Horizontal Pod Autoscaler is an API resource in the Kubernetes `autoscaling` API group.
|
The Horizontal Pod Autoscaler is an API resource in the Kubernetes
|
||||||
The current stable version, which only includes support for CPU autoscaling,
|
`autoscaling` API group. The current stable version can be found in
|
||||||
can be found in the `autoscaling/v1` API version.
|
the `autoscaling/v2` API version which includes support for scaling on
|
||||||
|
memory and custom metrics. The new fields introduced in
|
||||||
The beta version, which includes support for scaling on memory and custom metrics,
|
`autoscaling/v2` are preserved as annotations when working with
|
||||||
can be found in `autoscaling/v2beta2`. The new fields introduced in `autoscaling/v2beta2`
|
`autoscaling/v1`.
|
||||||
are preserved as annotations when working with `autoscaling/v1`.
|
|
||||||
|
|
||||||
When you create a HorizontalPodAutoscaler API object, make sure the name specified is a valid
|
When you create a HorizontalPodAutoscaler API object, make sure the name specified is a valid
|
||||||
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
|
[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names).
|
||||||
More details about the API object can be found at
|
More details about the API object can be found at
|
||||||
[HorizontalPodAutoscaler Object](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#horizontalpodautoscaler-v1-autoscaling).
|
[HorizontalPodAutoscaler Object](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#horizontalpodautoscaler-v2-autoscaling).
|
||||||
|
|
||||||
|
|
||||||
## Support for Horizontal Pod Autoscaler in kubectl
|
## Support for Horizontal Pod Autoscaler in kubectl
|
||||||
|
@ -299,7 +298,7 @@ the old container name from the HPA specification.
|
||||||
|
|
||||||
## Support for multiple metrics
|
## Support for multiple metrics
|
||||||
|
|
||||||
Kubernetes 1.6 adds support for scaling based on multiple metrics. You can use the `autoscaling/v2beta2` API
|
Kubernetes 1.6 adds support for scaling based on multiple metrics. You can use the `autoscaling/v2` API
|
||||||
version to specify multiple metrics for the Horizontal Pod Autoscaler to scale on. Then, the Horizontal Pod
|
version to specify multiple metrics for the Horizontal Pod Autoscaler to scale on. Then, the Horizontal Pod
|
||||||
Autoscaler controller will evaluate each metric, and propose a new scale based on that metric. The largest of the
|
Autoscaler controller will evaluate each metric, and propose a new scale based on that metric. The largest of the
|
||||||
proposed scales will be used as the new scale.
|
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
|
||||||
annotations for specifying which custom metrics to scale on are no longer honored by the Horizontal Pod Autoscaler controller.
|
annotations for specifying which custom metrics to scale on are no longer honored by the Horizontal Pod Autoscaler controller.
|
||||||
{{< /note >}}
|
{{< /note >}}
|
||||||
|
|
||||||
Kubernetes 1.6 adds support for making use of custom metrics in the Horizontal Pod Autoscaler.
|
You can also use a HorizontalPodAutoscaler to change the scale of a
|
||||||
You can add custom metrics for the Horizontal Pod Autoscaler to use in the `autoscaling/v2beta2` API.
|
workload based on custom metrics. You can add custom metrics for the
|
||||||
Kubernetes then queries the new custom metrics API to fetch the values of the appropriate custom metrics.
|
Horizontal Pod Autoscaler to use in the `autoscaling/v2` API.
|
||||||
|
Kubernetes then queries the new custom metrics API to fetch the values
|
||||||
|
of the appropriate custom metrics.
|
||||||
|
|
||||||
See [Support for metrics APIs](#support-for-metrics-apis) for the requirements.
|
See [Support for metrics APIs](#support-for-metrics-apis) for the requirements.
|
||||||
|
|
||||||
|
@ -349,12 +350,14 @@ and [the walkthrough for using external metrics](/docs/tasks/run-application/hor
|
||||||
|
|
||||||
Starting from
|
Starting from
|
||||||
[v1.18](https://github.com/kubernetes/enhancements/blob/master/keps/sig-autoscaling/853-configurable-hpa-scale-velocity/README.md)
|
[v1.18](https://github.com/kubernetes/enhancements/blob/master/keps/sig-autoscaling/853-configurable-hpa-scale-velocity/README.md)
|
||||||
the `v2beta2` API allows scaling behavior to be configured through the HPA
|
the `v2beta2` API (and from v1.23 the `v2` API) allows scaling
|
||||||
`behavior` field. Behaviors are specified separately for scaling up and down in
|
behavior to be configured through the HPA `behavior` field. Behaviors
|
||||||
`scaleUp` or `scaleDown` section under the `behavior` field. A stabilization
|
are specified separately for scaling up and down in `scaleUp` or
|
||||||
window can be specified for both directions which prevents the flapping of the
|
`scaleDown` section under the `behavior` field. A stabilization window
|
||||||
number of the replicas in the scaling target. Similarly specifying scaling
|
can be specified for both directions which prevents the flapping of
|
||||||
policies controls the rate of change of replicas while scaling.
|
the number of the replicas in the scaling target. Similarly specifying
|
||||||
|
scaling policies controls the rate of change of replicas while
|
||||||
|
scaling.
|
||||||
|
|
||||||
### Scaling Policies
|
### Scaling Policies
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue