kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.36k stars 1.06k forks source link

Keda not work with Prometheus and Cron target #5903

Open kadhamecha-conga opened 3 months ago

kadhamecha-conga commented 3 months ago

Report

Keda not working with two target as prometheus and cron. trigger based on prometheus is working fine, but when i have two target is not wokring as expected.

  • apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: example-app-scale spec: maxReplicaCount: 10 minReplicaCount: 1 scaleTargetRef: kind: Deployment name: example-app triggers:
  • type: prometheus metadata: serverAddress: http://prometheus.monitoring:9090 metricName: http_requests_total threshold: "100" query: sum(rate(http_requests_total{job="example-app"}[2m]))
  • type: cron metadata: timezone: US/Eastern start: "0 6 6" end: "0 0 0" desiredReplicas: "1"
    advanced: horizontalPodAutoscalerConfig: behavior: scaleDown: stabilizationWindowSeconds: 1800

Expected Behavior

it should work with both target

Actual Behavior

it is not scaling down on replicas based on cron .

Steps to Reproduce the Problem

1. 2. 3.

Logs from KEDA operator

example

KEDA Version

2.13.1

Kubernetes Version

1.28

Platform

None

Scaler Details

No response

Anything else?

No response

joebowbeer commented 2 months ago

I don't think your start/end times are supported by the cron scaler implementation.

You will need to split it into separate triggers, each with start < end.

sudohainguyen commented 2 weeks ago

bump since I'm encountering same issue prometheus trigger works fine alone by itself, but I want to combine with cron as a baseline for scaling up during specific periods