我最近部署了 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,pod将减少为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"}
暂无答案!
目前还没有任何答案,快来回答吧!