2023-12-14 21:52:03 +00:00
|
|
|
apiVersion: autoscaling/v2
|
2018-10-08 13:17:05 +02:00
|
|
|
kind: HorizontalPodAutoscaler
|
|
|
|
metadata:
|
|
|
|
name: custom-metrics-consumer
|
|
|
|
namespace: default
|
|
|
|
labels:
|
|
|
|
application: custom-metrics-consumer
|
|
|
|
annotations:
|
2020-11-04 20:40:53 +01:00
|
|
|
# metric-config.<metricType>.<metricName>.<collectorType>/<configKey>
|
2018-10-08 13:17:05 +02:00
|
|
|
metric-config.pods.queue-length.json-path/json-key: "$.queue.length"
|
|
|
|
metric-config.pods.queue-length.json-path/path: /metrics
|
|
|
|
metric-config.pods.queue-length.json-path/port: "9090"
|
|
|
|
# metric-config.object.requests-per-second.prometheus/query: |
|
|
|
|
# scalar(sum(rate(skipper_serve_host_duration_seconds_count{host="custom-metrics_example_org"}[1m])))
|
|
|
|
# metric-config.object.requests-per-second.prometheus/per-replica: "true"
|
|
|
|
# metric-config.object.requests-per-second.skipper/interval: "1s"
|
|
|
|
spec:
|
|
|
|
scaleTargetRef:
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
name: custom-metrics-consumer
|
|
|
|
minReplicas: 1
|
|
|
|
maxReplicas: 10
|
|
|
|
metrics:
|
|
|
|
# - type: Resource
|
|
|
|
# resource:
|
|
|
|
# name: cpu
|
2020-01-24 10:20:59 +01:00
|
|
|
# current:
|
|
|
|
# averageUtilization: 50
|
|
|
|
|
2018-10-08 13:17:05 +02:00
|
|
|
- type: Pods
|
|
|
|
pods:
|
2020-01-24 10:20:59 +01:00
|
|
|
metric:
|
|
|
|
name: queue-length
|
|
|
|
target:
|
|
|
|
averageValue: 1k
|
|
|
|
type: AverageValue
|
|
|
|
|
2018-10-08 13:17:05 +02:00
|
|
|
- type: Object
|
|
|
|
object:
|
2020-01-24 10:20:59 +01:00
|
|
|
describedObject:
|
2022-01-05 17:53:06 +01:00
|
|
|
apiVersion: networking.k8s.io/v1
|
2018-10-08 13:17:05 +02:00
|
|
|
kind: Ingress
|
|
|
|
name: custom-metrics-consumer
|
2020-01-24 10:20:59 +01:00
|
|
|
metric:
|
|
|
|
name: requests-per-second
|
|
|
|
target:
|
|
|
|
averageValue: "10"
|
|
|
|
type: AverageValue
|
2018-10-08 13:17:05 +02:00
|
|
|
- type: External
|
|
|
|
external:
|
2020-01-24 10:20:59 +01:00
|
|
|
metric:
|
2020-11-04 20:40:53 +01:00
|
|
|
name: app-queue-length
|
2020-01-24 10:20:59 +01:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
2020-11-04 20:40:53 +01:00
|
|
|
type: sqs-queue-length
|
2020-01-24 10:20:59 +01:00
|
|
|
queue-name: foobar
|
|
|
|
region: eu-central-1
|
|
|
|
target:
|
|
|
|
averageValue: "30"
|
|
|
|
type: AverageValue
|