With plain HPAs it is possible to scale the underlying deployment manually to zero. This is required for eg. maintainance tasks. When scaling back to a value greater zero, the scaling continues as before.
This is the command executed: kubectl scale deployment my-deployment --replicas=0
With KEDA however, this is not possible. The only place in the documentation states:
KEDA will not enforce that value, meaning you can manually scale the deployment to 0 and KEDA will not scale it back up. However, when KEDA itself is scaling the deployment it will respect the value set there.
I can not confirm this behaviour, nor does the previous scaling command works. Manually changing the minReplicas
and maxReplicas
to zero throws a lot of errors in the keda log, the same happens when pointing the deployment to an fake-value.
I need a way to scale to zero temporary (deleting the ScaledObject works of course, but then I need to store them somewhere, which is also errorprone and counterintuitive). This should work independant from the value of minReplicaCount
.
Using Kubernetes 1.15, keda 1.5.0. Example ScaledObject:
apiVersion: keda.k8s.io/v1alpha1
kind: ScaledObject
metadata: ... # left out
spec:
cooldownPeriod: 600
maxReplicaCount: 8
minReplicaCount: 0
pollingInterval: 30
scaleTargetRef:
containerName: main
deploymentName: my-deployment
scaleType: deployment
triggers:
- type: kafka
... # left out
status:
externalMetricNames:
- lagThreshold
lastActiveTime: "2020-07-21T11:32:31Z"