Skip to content

Commit 0f7a6b9

Browse files
author
Zeusro
committed
Fri Jan 23 16:47:23 CST 2026
1 parent 2bfc6c2 commit 0f7a6b9

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

example/ScaledObject.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: keda.sh/v1alpha1
2+
kind: ScaledObject
3+
metadata:
4+
name: myapp-scaledobject
5+
namespace: default
6+
spec:
7+
scaleTargetRef:
8+
name: myapp # 要缩容的 Deployment/StatefulSet
9+
minReplicaCount: 0 # 支持缩到 0
10+
maxReplicaCount: 10
11+
triggers:
12+
- type: prometheus
13+
metadata:
14+
serverAddress: http://prometheus-server.monitoring.svc:9090
15+
metricName: http_requests_per_second
16+
query: |
17+
sum(rate(http_requests_total{namespace="default",pod=~"^myapp-.*"}[2m]))
18+
threshold: "100" # 总请求速率 >100 就扩容
19+
activationThreshold: "5" # <5 才缩容(防抖动)

0 commit comments

Comments
 (0)