Scale to zero with cron trigger #1759
-
ReportHi !, apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: scale-to-zero
namespace: default
spec:
minReplicaCount: 1
maxReplicaCount: 5
cooldownPeriod: 30
scaleTargetRef:
name: my-deployment
triggers:
- type: cron
metadata:
timezone: Asia/Jerusalem
start: 18 * * * *
end: 30 * * * *
desiredReplicas: "0" I probably didn't configure something right.. didnt find any doc's regarding this use-case Expected BehaviorThe number of replicas should decrease to 0 Actual BehaviorNothing Steps to Reproduce the Problem
Logs from KEDA operatorNo response KEDA Version2.2.0 Kubernetes Version1.16 PlatformAmazon Web Services Scaler DetailsCron Anything else?No response |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 19 replies
-
I looks like you're explicitly telling it to have at least one instance: minReplicaCount: 1 Can you change that to 0 and try again please? |
Beta Was this translation helpful? Give feedback.
-
When setting the minReplicaCount to 0, i get no pods even though the ScaledObject is not triggered. Any idea what am i doing wrong ? |
Beta Was this translation helpful? Give feedback.
-
Any updates ? |
Beta Was this translation helpful? Give feedback.
-
I will try to explain : First thing i tried is to set the following object :
It means - during the weekdays, the minReplicaCount should be 1 and the maxReplicaCount should be 5 and during the weekends, it should be 0. Then, i tried the opposite way,
All the time it should be 0 unless its weekdays. |
Beta Was this translation helpful? Give feedback.
-
@tomkerkhove i'm looking for a scale-to-zero solution triggered by time, is Keda supports it ? |
Beta Was this translation helpful? Give feedback.
-
I have the same problem. not scaling to zero with:
I am trying to scale to zero between start and end. |
Beta Was this translation helpful? Give feedback.
-
This config works for me. There are replicas only during the specified interval and no replicas outside these hours. apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: test-replica-zero
spec:
cooldownPeriod: 300
maxReplicaCount: 2
minReplicaCount: 0
pollingInterval: 30
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: test-replica-zero
triggers:
- metadata:
desiredReplicas: "1"
start: 50 19 * * *
end: 30 20 * * *
timezone: America/Sao_Paulo
type: cron |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
I have the same problem. not scaling to zero with:
I am trying to scale to zero between start and end.
But it doesn't