3

最近keda-2.0.0.yaml、キューに基づいて sidekiq ワーカーをスケーリングするためにデプロイしました。

私のセットアップをどうぞ:

apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: redis-auth
  namespace: xxxx
spec:
  secretTargetRef:
  - parameter: password
    name: redis-secret
    key: redis_password
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: sidekiq-worker-scaler
  namespace: xxxx
spec:
  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

私はすでに間違ったキュー名、間違ったパスワードを設定し、キューを変更し、ポッドが 0 から 1 および 1 から 0 にスケーリングされていることを確認できるため、現在は機能しています。ただし、1 を超えるスケーリングはありません。

1975年のジョブがredisリストにエンキューされていても.

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

奇妙だと思うのは、ターゲット値だけで、常に不明です。

NAME                             REFERENCE                            TARGETS             MINPODS   MAXPODS   REPLICAS   AGE
keda-hpa-sidekiq-worker-scaler   Deployment/xxxx-worker0-deploy   <unknown>/5 (avg)   1         10        1          4h19m

キューの長さが 0 になると、ポッドは 0 に削減されます。以下はデバッグ レベルのログです。

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"}
4

0 に答える 0