Skip to content

Instantly share code, notes, and snippets.

@lomkju
Last active May 11, 2020 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lomkju/f8995a97a1b30d9610b11e4cc54dcf40 to your computer and use it in GitHub Desktop.
Save lomkju/f8995a97a1b30d9610b11e4cc54dcf40 to your computer and use it in GitHub Desktop.
HPA Examples
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: kafka-consumer
annotations:
# metric-config.<metricType>.<metricName>.<collectorName>/<configKey>
metric-config.external.http.json/json-key: "$stats"
metric-config.external.http.json/endpoint: "http://www.mocky.io/v2/5eb958772f0000b32c3c3098"
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: kafka-consumer
minReplicas: 1
maxReplicas: 10
metrics:
- type: External
external:
metric:
name: http
selector:
matchLabels:
identifier: kafka_topic_length
target:
averageValue: 50
type: AverageValue
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: kafka-consumer-v2
annotations:
# metric-config.<metricType>.<metricName>.<collectorName>/<configKey>
metric-config.external.prometheus-query.prometheus/prometheus-server: http://10.210.4.121:9090
metric-config.external.prometheus-query.prometheus/event-process-latency: |
scalar(event_process_latency_last_10_seconds)
metric-config.external.http.json/json-key: "$stats"
metric-config.external.http.json/endpoint: "http://www.mocky.io/v2/5eb958772f0000b32c3c3098"
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: kafka-consumer-v2
minReplicas: 1
maxReplicas: 10
metrics:
- type: External
external:
metric:
name: http
selector:
matchLabels:
identifier: kafka_topic_length
target:
averageValue: 50
type: AverageValue
- type: External
external:
metric:
name: prometheus-query
selector:
matchLabels:
query-name: event-process-latency
target:
type: AverageValue
averageValue: 150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment