Hello,
I am using KEDA successfully to scale a deployment relatively to a RabbitMQ queue.
Unfortunately, I am facing a problem with KEDA, where insists that the minimum number of pods of my deployment is 1, leading it (I suspect) to scale it back up every time it is supposed to be scaled to 0.
Here is the output of the command kubectl get hpa. Notice the value of the field MINPODS:
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
horizontalpodautoscaler.autoscaling/keda-hpa-prototype-scanner-worker-worker-helm Deployment/prototype-scanner-worker-worker-helm 0/1 (avg) 1 100 1 17m
In my use case, this interferes heavily with the way my cluster is supposed to run and I believe that the README of the RabbitMQ sample specifies that:
The ScaledObject included in the above deployment is set to scale to a minimum of 0 replicas on no events
I also can't seem to find where I can explicitly set the MINPODS value.
I do not remember facing this issue few weeks ago, so maybe it is related to a recent commit.
Let me know of you need additional information :dove:
Can you try to reinstall KEDA on your cluster? we recently pushed a new version that should fix this.
I have installed the latest version of KEDA, and the problem seems gone and resolved. My deployment scales back to 0 when the queue is empty.
But to give you more context, I further investigated the pod that was restarting before, and that can be due to other reasons, out of KEDA's scope. Just letting you know in case you are still debugging, and to review the changes.
About the MINPODS value. It is shown in Horizontal Pod Autoscaler as 1? Should I not worry about it? Because it seems to me that KEDA scales the consumer to 0 if the queue is empty? Is there an attribute for it I can set in the YAML file, like maxReplicaCount?
Another clarification if possible. What does the value TARGETS means? currentReplicas/DesiredReplicas?
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
horizontalpodautoscaler.autoscaling/keda-hpa-prototype-scanner-worker-worker-helm Deployment/prototype-scanner-worker-worker-helm 667m/1 (avg) 1 100 3 118s
Thanks
:dove:
The min pods in the HPA will not show 0 because the HPA doesn't (today) support 0 minReplicas, so that's OK.
Regarding min and max for KEDA, you can set minReplicaCount and maxReplicaCount on the spec.
See here.
Closing this issue for now.
Can you explain to me the targets attribute?
It shows some values that I can understand, like the example above.
The HPA targets value shows the current avg for the metric value across all pods / desired threshold.
So, it shows the number of message in the queue? What is the metric in question? 667mm, what does the mm means?
Please bare with me, I can't find a precise description in the doc about this.
The HPA is not a KEDA resource.
The values you see on the HPA are not representative of the ones used in KEDA. Its based on Kubernetes HPA metric values, in this case mili quantities.