-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add external metrics to HPA docs #7664
Merged
k8s-ci-robot
merged 3 commits into
kubernetes:release-1.10
from
MaciekPytel:hpa_external
Mar 12, 2018
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,9 @@ heapster monitoring will be turned-on by default). | |
|
||
To specify multiple resource metrics for a Horizontal Pod Autoscaler, you must have a Kubernetes cluster | ||
and kubectl at version 1.6 or later. Furthermore, in order to make use of custom metrics, your cluster | ||
must be able to communicate with the API server providing the custom metrics API. | ||
must be able to communicate with the API server providing the custom metrics API. Finally, to use metrics | ||
not related to any Kubernetes object you must have a Kubernetes cluster at version 1.10 or later, and | ||
you must be able to communicate with the API server that provides the external metrics API. | ||
See the [Horizontal Pod Autoscaler user guide](/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics) for more details. | ||
|
||
## Step One: Run & expose php-apache server | ||
|
@@ -267,6 +269,35 @@ Then, your HorizontalPodAutoscaler would attempt to ensure that each pod was con | |
50% of its requested CPU, serving 1000 packets per second, and that all pods behind the main-route | ||
Ingress were serving a total of 10000 requests per second. | ||
|
||
### Autoscaling on metrics not related to Kubernetes objects | ||
|
||
Applications running on Kubernetes may need to autoscale based on metrics that don't have an obvious | ||
relationship to any object in the Kubernetes cluster, such as metrics describing a hosted service used | ||
by Pods. In Kubernetes 1.10 and later, you can address this use case with *external metrics*. | ||
|
||
Using external metrics requires a certain level of knowledge of your monitoring system, and it requires a cluster | ||
monitoring setup similar to one required for using custom metrics. With external metrics, you can autoscale | ||
based on any metric available in your monitoring system by providing a `metricName` field in your | ||
HorizontalPodAutoscaler manifest. Additionally you can use a `metricSelector` field to limit which | ||
metrics' time series you want to use for autoscaling. If multiple time series are matched by `metricSelector`, | ||
the sum of their values is used by the HorizontalPodAutoscaler. | ||
|
||
For example if your application processes tasks from a hosted queue service, you could add the following | ||
section to your HorizontalPodAutoscaler manifest to specify that you need one worker per 30 outstanding tasks. | ||
|
||
```yaml | ||
- type: External | ||
external: | ||
metricName: queue_messages_ready | ||
metricSelector: | ||
matchLabels: | ||
queue: worker_tasks | ||
targetAverageValue: 30 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. describe what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added description |
||
``` | ||
|
||
Instead of using the `targetAverageValue` field, you could use the `targetValue` to define a desired | ||
value of your external metric. | ||
|
||
## Appendix: Horizontal Pod Autoscaler Status Conditions | ||
|
||
When using the `autoscaling/v2beta1` form of the HorizontalPodAutoscaler, you will be able to see | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done