Configuring scale bounds

To apply upper and lower bounds to autoscaling behavior, you can specify scale bounds in both directions.

Lower bound

This value controls the minimum number of replicas that each revision should have. Knative will attempt to never have less than this number of replicas at any one point in time.

  • Global key: n/a
  • Per-revision annotation key: autoscaling.knative.dev/minScale
  • Possible values: integer
  • Default: 0 if scale-to-zero is enabled and class KPA is used, 1 otherwise

NOTE: For more information about scale-to-zero configuration, see the documentation on Configuring scale to zero.

Example:

  1. apiVersion: serving.knative.dev/v1
  2. kind: Service
  3. metadata:
  4. name: helloworld-go
  5. namespace: default
  6. spec:
  7. template:
  8. metadata:
  9. annotations:
  10. autoscaling.knative.dev/minScale: "3"
  11. spec:
  12. containers:
  13. - image: gcr.io/knative-samples/helloworld-go

Upper bound

This value controls the maximum number of replicas that each revision should have. Knative will attempt to never have more than this number of replicas running, or in the process of being created, at any one point in time.

  • Global key: n/a
  • Per-revision annotation key: autoscaling.knative.dev/maxScale
  • Possible values: integer
  • Default: 0 which means unlimited

Example:

  1. apiVersion: serving.knative.dev/v1
  2. kind: Service
  3. metadata:
  4. name: helloworld-go
  5. namespace: default
  6. spec:
  7. template:
  8. metadata:
  9. annotations:
  10. autoscaling.knative.dev/maxScale: "3"
  11. spec:
  12. containers:
  13. - image: gcr.io/knative-samples/helloworld-go