-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkeda-scaled-object.yaml
23 lines (23 loc) · 1.02 KB
/
keda-scaled-object.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: keda-multi-metrics-scaler
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: go-rest-api-deployment
pollingInterval: 20 # Must be seconds
minReplicaCount: 2
maxReplicaCount: 7
cooldownPeriod: 30
triggers:
- type: prometheus
metadata:
serverAddress: http://prometheus-server.prometheus.svc.cluster.local:80
threshold: '10' # one instance per 10 queue messages
query: ((msg_queue_length)*(clamp(rate_429_errors < 5,1,1))) OR on() ((kube_deployment_status_replicas_ready{deployment='go-rest-api-deployment'}- 1) * 10)
# query: (msg_queue_length)*(clamp_min(clamp_max((rate_429_errors < 5),1),1)) OR on() vector(0)
# The above query returns the queue length if the rate of errors is less than the threshold
# Otherwise it returns one fewer than then number of current replicas (multiplied by 10, the threshold value)
# so that the number of replicas is reduced by one when we have too many errors