keda icon indicating copy to clipboard operation
keda copied to clipboard

ScaledJob scaling calculation is different from ScaledObject scaling calculation

Open matanagazan opened this issue 3 months ago • 0 comments

Report

I change my service template from Kubernetes deployment to Kubernetes job So I adapted my ScaledObject to ScaledJob the scaling calculation worked fine with ScaledObject, but when I changed to ScaledJob it scaled jobs not as expected

Expected Behavior

My scaling goal: X pods ready at any point in time (1/1 Running). When a pod is entering into a non ready status (0/1 Running), I want KEDA to scale another pod. So I use the Prometheus trigger in order to build a query that returned me the desired number of ready replicas.

Example: we want 3 ready pods to be available. So the query will be: (3 - sum(kube_pod_status_ready{namespace="...", pod=~"...", condition="true"}) + sum(kube_pod_container_status_running{namespace="...", container="..."}))

Threshold is constant threshold=1

So the formula is: (desiredReadyPodsCount(3) - runningReadyPodsCount + runningPodsCount) / threshold(1)

Actual Behavior

When I use ScaledObject is working perfect and when I changed to ScaledJob it behaves completely different than expceted

Steps to Reproduce the Problem

Make scaling strategy permanent between ScaledObject and ScaledJob

Logs from KEDA operator

example

KEDA Version

2.11.2

Kubernetes Version

1.25

Platform

Amazon Web Services

Scaler Details

Prometheus

Anything else?

No response

matanagazan avatar Apr 10 '24 14:04 matanagazan