Pausing Autoscaling in KEDA
KEDA allows you to pause autoscaling of workloads temporarily, which is useful for:
- Cluster maintenance.
- Avoiding resource starvation by scaling down non-critical workloads.
TOC
ProcedureImmediate Pause with Current ReplicasPause After Scaling to a Specific Replica CountBehavior When Both Annotations are SetUnpausing AutoscalingScaling to ZeroVerificationProcedure
Immediate Pause with Current Replicas
Add the following annotation to your ScaledObject definition to pause scaling without changing the current replica count:
Pause After Scaling to a Specific Replica Count
Use this annotation to scale the workload to a specific number of replicas and then pause:
Behavior When Both Annotations are Set
If both paused and paused-replicas are specified:
- KEDA scales the workload to the value defined in paused-replicas.
- Autoscaling is paused afterward.
Unpausing Autoscaling
To resume autoscaling:
- Remove both paused and paused-replicas annotations from the ScaledObject.
- If only paused: "true" was used, set it to false:
Scaling to Zero
Example ScaledObject Configuration:
Verification
To verify that the ScaledObject has scaled to zero, you can check the number of replicas of the target deployment:
Or you can check the number of pods in the target deployment:
The number of pods should be zero, indicating that the deployment has scaled to zero.