Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0->1 scale up does not work due to circular dependency #6040

Closed
Jackjglu opened this issue Aug 6, 2024 · 2 comments
Closed

0->1 scale up does not work due to circular dependency #6040

Jackjglu opened this issue Aug 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Jackjglu
Copy link

Jackjglu commented Aug 6, 2024

Report

When trigger metrics comes from replica itself, 0->1 scale currently would not work since there is a circular dependency. No metrics data can be retrieved since there is 0 replica to serve the endpoint, thus KEDA does not trigger 0->1.

Expected Behavior

0->1 scale up works when there are traffic and idleReplicaCount set to 0.

Actual Behavior

1->0 works when there are no traffic and idleReplicaCount set to 0. The metrics comes from the replica. When there are traffic coming, 0->1 doesn't work, the replica stays at 0.

Steps to Reproduce the Problem

  1. ScaleObject used
    spec:
    maxRepicaCount: 8
    minReplicaCount: 1
    idleReplicaCount: 0
    ...
    triggers:
  1. scale down traffic to the service endpoint to 0, can see replica set scale down to 0 eventually
  2. add traffic to service endpoint, replica set remains at 0

Logs from KEDA operator

example

KEDA Version

2.14.1

Kubernetes Version

1.28

Platform

Microsoft Azure

Scaler Details

Prometheus

Anything else?

No response

@Jackjglu Jackjglu added the bug Something isn't working label Aug 6, 2024
@JorTurFer
Copy link
Member

Hello
The problem here is that you are trying to scale an HTTP workload, and it works quite different. It doesn't matter if you use your application metric or the ingress metric, it won't work to scale from zero because nobody is holding the request.

About the original title, this isn't a bug for KEDA but an architecture issue totally unrelated with KEDA. If the metric is there, KEDA will work, but ensuring that the metric is available isn't the responsibility of KEDA. It's the same as you could have with other sources like CPU or memory, 0 instances will never trigger any scaling because 0 instances implicitly means 0 consumption, nothing related with the metrics server.

About the actual issue that you have, if you want to scale from 0 an HTTP workload, you need something in the middle that holds the request until the backend is up un running, otherwise your ingress will return an error because there isn't any available backend to response the request. The only option that we can suggest atm to allow scaling from/to zero an HTTP workload is the HTTP Add-on -> https://github.com/kedacore/http-add-on
The add-on is a component that holds the request until the backend is up and running, exposing metrics to KEDA to trigger the scaling.

I close the issue as it's not a bug but a design fact, but feel free to comment whatever you think that it's useful

@JorTurFer JorTurFer closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2024
@zroubalik
Copy link
Member

That's correct, great summary by Jorge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready To Ship
Development

No branches or pull requests

3 participants