Autoscaling concepts
Knative Serving supports the implementation of Knative Pod Autoscaler (KPA) and Kubernetes’ Horizontal Pod Autoscaler (HPA). The features and limitations of each of these Autoscalers are listed below.
IMPORTANT: If you want to use Kubernetes Horizontal Pod Autoscaler (HPA), you must install it after you install Knative Serving.
- 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.
Horizontal Pod Autoscaler (HPA)
- Not part of the Knative Serving core, and must be enabled after Knative Serving installation.
- Does not support scale to zero functionality.
- Supports CPU-based autoscaling.
- Per-revision annotation key:
autoscaling.knative.dev/class
- Possible values: or
"hpa.autoscaling.knative.dev"
- Default:
"kpa.autoscaling.knative.dev"
Example:
Global versus per-revision settings
Configuring for autoscaling in Knative can be set using either global or per-revision settings.
- If no per-revision autoscaling settings are specified, the global settings will be used.
Global settings
Example of the default autoscaling ConfigMap
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.