I recently deployed keda-2.0.0.yaml
to scale my sidekiq workers based on its queue.
Thay my setup:
apiVersion: keda.sh/v1alpha1kind: TriggerAuthenticationmetadata: name: redis-auth namespace: xxxxspec: secretTargetRef: - parameter: password name: redis-secret key: redis_password---apiVersion: keda.sh/v1alpha1kind: ScaledObjectmetadata: name: sidekiq-worker-scaler namespace: xxxxspec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: xxxx-worker0-deploy # POD name to be scaled pollingInterval: 10 cooldownPeriod: 60 minReplicaCount: 0 maxReplicaCount: 10 triggers: - type: redis metadata: address: 192.168.1.20:6379 listName: queue:low_priority #Sidekiq queue listLength: "5" authenticationRef: name: redis-auth
I now it's working becuase I already setup the wrong queue name, wrong password, chaged the queue and I can see the pod scaling from 0 to 1 and from 1 to 0. But it never scales more than 1.
Even with 1975 jobs enqueued in redis list.
192.168.1.20:6379> keys *queue*1) "queue:low_priority"2) "queues"3) "queue:site_product_es"192.168.1.20:6379> llen queue:low_priority(integer) 1975
Now the only thing I though it's weird is the target value, always unknown.
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGEkeda-hpa-sidekiq-worker-scaler Deployment/xxxx-worker0-deploy <unknown>/5 (avg) 1 10 1 4h19m
Once the queue length is 0, the pod is reduced to 0.Below is the debug level log.
2020-11-20T03:14:50.107Z INFO scaleexecutor Successfully updated ScaleTarget {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "Original Replicas Count": 0, "New Replicas Count": 1}2020-11-20T03:14:51.850Z INFO controllers.ScaledObject Reconciling ScaledObject {"ScaledObject.Namespace": "alpha4", "ScaledObject.Name": "sidekiq-worker-scaler"}2020-11-20T03:14:51.850Z DEBUG controllers.ScaledObject Parsed Group, Version, Kind, Resource {"ScaledObject.Namespace": "alpha4", "ScaledObject.Name": "sidekiq-worker-scaler", "GVK": "apps/v1.Deployment", "Resource": "deployments"}2020-11-20T03:14:51.865Z DEBUG controllers.ScaledObject ScaledObject is defined correctly and is ready for scaling {"ScaledObject.Namespace": "alpha4", "ScaledObject.Name": "sidekiq-worker-scaler"}2020-11-20T03:14:51.870Z DEBUG controller Successfully Reconciled {"reconcilerGroup": "keda.sh", "reconcilerKind": "ScaledObject", "controller": "scaledobject", "name": "sidekiq-worker-scaler", "namespace": "alpha4"}2020-11-20T03:15:00.144Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:15:10.160Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:15:20.183Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:15:10 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:15:30.200Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:15:10 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:15:40.210Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:15:10 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:15:50.217Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:16:00.238Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:16:10.255Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:16:20.271Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:16:30.287Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:16:40.302Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:16:50.316Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:17:00.332Z DEBUG scalehandler Scaler for scaledObject is active {"Metrics Name": "redis-queue-low_priority"}2020-11-20T03:17:10.350Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:17:00 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:17:20.366Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:17:00 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:17:30.376Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:17:00 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:17:40.385Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:17:00 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:17:50.394Z DEBUG scaleexecutor ScaleTarget cooling down {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy", "LastActiveTime": "2020-11-20 03:17:00 +0000 UTC", "CoolDownPeriod": "1m0s"}2020-11-20T03:18:00.410Z INFO scaleexecutor Successfully scaled ScaleTarget to 0 replicas {"scaledobject.Name": "sidekiq-worker-scaler", "scaledObject.Namespace": "alpha4", "scaleTarget.Name": "alpha4au-worker0-deploy"}