Repository navigation
Description
Problem
Knative autoscaling should be pluggable at the bottom. Currently only the KPA is supported.
(source)
Proposal
Summary of work
- Expose metrics (concurrency and qps) from the
queue-proxyin Prometheus format (Expose metrics from the queue-proxy #2202) - Configure Prometheus to scrape pods for metrics (Autoscaler to scrape pods for metrics #2203)
- Update the KPA implementation to query Prometheus for average concurrency (60 and 6 second windows) -- removing the
queue-proxymetrics push (Query Prometheus for average concurrency #2204) - Make the Autoscaling reconciler only operate on PodAutoscalers with the
autoscaling.knative.dev/class=kpaannotation (Have the KPA controller ignore explicitly annotated KPAs #1928) - Implement a new, parallel Autoscaling reconciler which only operates on PodAutoscalers with the
autoscaling.knative.dev/class=hpaannotation, stamping out HPA CRDs.
Architecture
Extensibility
Other reconcilers
To provide an alternative autoscaling implementation, an Operator should install a PodAutoscaler reconciler which handles the autoscaling.knative.dev/class=<other> annotation. The Namespace, Service, Configuration or Revision can be annotated with other and the default reconcilers will leave it alone.
Other metrics
To select between various metrics, Operators can provide the autoscaling.knative.dev/metric annotation with a value of concurrency, qps, cpu or custom.
autoscaling.knative.dev/metric=concurrency
Supported by the KPA and maybe the HPA. Supports the following annotations:
autoscaling.knative.dev/targetto override the default target of 70%containerConcurrency.
autoscaling.knative.dev/metric=qps
Supported by the KPA and maybe the HPA. Supports the following annotations:
- (required)
autoscaling.knative.dev/targetto select the target qps
autoscaling.knative.dev/metric=cpu
Supported by the HPA only. Supports the following annotations:
autoscaling.knative.dev/cpuUtilizationPercentageto override the default target
autoscaling.knative.dev/metric=custom
Supported by the HPA only. Supports the following annotations:
- (required)
autoscaling.knative.dev/metricPathto specify the path at which the application will export Prometheus metrics. - (required)
autoscaling.knative.dev/metricNameto specify the name of the metric to scale on.
Limitations
Scale-to-zero does not work with the Kubernetes HPA. TODO(josephburnett): figure out how to make this happen.


Activity
lichuqiang commentedon Oct 10, 2018
/cc
erain commentedon Oct 17, 2018
/cc
mattmoor commentedon Jun 18, 2019
I'm ready to declare this done after @markusthoemmes latest PR, which adds e2e testing for using the HPA with concurrent request metrics.
If nobody chimes in with what work remains, I'm inclined to close this out (and may close it out anyways if what remains is out of scope for "v1").
cc @josephburnett @vagababov
mattmoor commentedon Jun 24, 2019
@markusthoemmes mentioned one limitation we have today that I'd like to surface here, which is that the metrics collection is triggered by in-memory Metrics resources, so being able to truly plug in new autoscalers are limited to in-process. Correcting this is already tracked separately.
I think that with the HPA testing we now have that I'm fairly happy with the model, and that what we have is probably sufficient to know that we won't require radical changes to the model to expand this beyond in-process.
As we move to "v1" and beyond, I think we are going to want to replace our use of umbrella issues like this with Projects that collect the assorted issues that comprise them, and give us better visibility into their overall status.
So I'm going to close this, and we can discuss pulling in any remaining issues that we want to be in scope.