Supported Autoscaler types
Important
If you want to use Kubernetes Horizontal Pod Autoscaler (HPA), you must install it after you install Knative Serving.
For how to install HPA, see Install optional Serving extensions.
- Part of the Knative Serving core and enabled by default once Knative Serving is installed.
- Supports scale to zero functionality.
- Does not support CPU-based autoscaling.
- Not part of the Knative Serving core, and you must install Knative Serving first.
- Supports CPU-based autoscaling.
The type of Autoscaler implementation (KPA or HPA) can be configured by using the annotation.
- Global settings key:
pod-autoscaler-class
- Per-revision annotation key:
autoscaling.knative.dev/class
- Possible values: or
"hpa.autoscaling.knative.dev"
- Default:
"kpa.autoscaling.knative.dev"
Per Revision
Global (ConfigMap)
Global (Operator)
Configuring for autoscaling in Knative can be set using either global or per-revision settings.
- If per-revision settings are specified, these will override the global settings when both types of settings exist.
Global settings
Example of the default autoscaling ConfigMap
Per-revision settings
Per-revision settings for autoscaling are configured by adding annotations to a revision.
Example:
Important
If you are creating revisions by using a service or configuration, you must set the annotations in the revision template so that any modifications will be applied to each revision as they are created. Setting annotations in the top level metadata of a single revision will not propagate the changes to other revisions and will not apply changes to the autoscaling configuration for your application.