Is there a 'master switch' to enable/disable Keda and HPA? I can enable/disable scaling rules by editing the replicacount to 0, but is there a main enalbe/disable field?
cooldownPeriod: 1800
maxReplicaCount: 8
minReplicaCount: 2
pollingInterval: 300
CodePudding user response:
You can enable/disable scaling rules either by editing the replica count to 0 or you can use a single field called Pause autoscaling.
Pause autoscaling lets you enable/disable autoscaling by using autoscaling.keda.sh/paused-replicas annotation. It can be useful to instruct KEDA to pause autoscaling of objects, if you want to do cluster maintenance or you want to avoid resource starvation by removing non-mission-critical workloads.
You can enable this by adding the below annotation to your ScaledObject
definition:
metadata:
annotations:
autoscaling.keda.sh/paused-replicas: "0"
The presence of this annotation will pause autoscaling no matter what number of replicas is provided. The above annotation will scale your current workload to 0 replicas and pause autoscaling. You can set the value of replicas for an object to be paused at any arbitrary number. To enable autoscaling again, simply remove the annotation from the ScaledObject
definition.
Refer to the KEDA documentation for more information.