63 lines
2.2 KiB
YAML
63 lines
2.2 KiB
YAML
apiVersion: v1
|
||
kind: Secret
|
||
metadata:
|
||
name: keda-prom-secret
|
||
namespace: bj2-dcloud
|
||
stringData:
|
||
customAuthHeader: "Authorization"
|
||
customAuthValue: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lc3BhY2UiOiJjcHJvbS11ejJuZ3J6YmpyN243Iiwic2VjcmV0TmFtZSI6IjJjMTI4NGJhZTUxYjRiZjNhMmU2MjM1NTc4NDRjNmQ2IiwiZXhwIjo0OTIzODc3ODIyLCJpc3MiOiJjcHJvbSJ9.idZaTKtQR4WOyr29T_TKZ9cGz2nW9N5Mw-5SBu321p8"
|
||
|
||
---
|
||
apiVersion: keda.sh/v1alpha1
|
||
kind: TriggerAuthentication
|
||
metadata:
|
||
name: keda-prom-creds
|
||
namespace: bj2-dcloud
|
||
spec:
|
||
secretTargetRef:
|
||
- parameter: customAuthHeader
|
||
name: keda-prom-secret
|
||
key: customAuthHeader
|
||
- parameter: customAuthValue
|
||
name: keda-prom-secret
|
||
key: customAuthValue
|
||
|
||
---
|
||
apiVersion: keda.sh/v1alpha1
|
||
kind: ScaledObject
|
||
metadata:
|
||
name: gpu-metrics-scaledobject
|
||
namespace: bj2-dcloud
|
||
spec:
|
||
scaleTargetRef:
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
name: dstereox
|
||
minReplicaCount: 1
|
||
maxReplicaCount: 2
|
||
idleReplicaCount: 0 # 当指标为0时,保持0副本
|
||
pollingInterval: 30 # 每30秒检查一次指标
|
||
cooldownPeriod: 300 # 扩容后等待5分钟再进行下一次扩容
|
||
# initialCooldownPeriod: 0 # 启动后立即检查指标
|
||
|
||
# fallback: # Optional. Section to specify fallback options
|
||
# failureThreshold: 3 # Mandatory if fallback section is included
|
||
# replicas: 6 # Mandatory if fallback section is included
|
||
# behavior: {kind-of-behavior} # Optional. Default: "static"
|
||
triggers:
|
||
# ---------------------------------------------------------
|
||
# 触发器 1: 基于 volcano 队列的pending任务数
|
||
# ---------------------------------------------------------
|
||
- type: prometheus
|
||
metadata:
|
||
serverAddress: https://cprom.bj.baidubce.com/select/prometheus
|
||
metricName: queuue_pending_tasks
|
||
query: sum(volcano_queue_pod_group_pending_count{queue_name="dcloud"})
|
||
customHeaders: InstanceId=cprom-uz2ngrzbjr7n7
|
||
threshold: "1"
|
||
activationThreshold: "1"
|
||
authModes: "custom"
|
||
authenticationRef:
|
||
name: keda-prom-creds
|
||
|