Skip to content

Instantly share code, notes, and snippets.

@nakamasato
Last active July 1, 2021 23:07
Show Gist options
  • Save nakamasato/f6336b48101680c9284cd640165626af to your computer and use it in GitHub Desktop.
Save nakamasato/f6336b48101680c9284cd640165626af to your computer and use it in GitHub Desktop.
Kubernetes HPA with custom metrics (RabbitMQ and Prometheus)
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: rabbitmq-consumer
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: rabbitmq-consumer
minReplicas: 1
maxReplicas: 20
metrics:
- type: Object
object:
metric:
name: rabbitmq_queue_messages_ready
describedObject:
kind: Pod
name: rabbitmq-server-0
apiVersion: v1
target:
type: Value
averageValue: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment