Skip to content

Instantly share code, notes, and snippets.

@yelinaung
Created July 2, 2021 05:29
Show Gist options
  • Save yelinaung/545ad512065f0dab8830c854cad3f593 to your computer and use it in GitHub Desktop.
Save yelinaung/545ad512065f0dab8830c854cad3f593 to your computer and use it in GitHub Desktop.
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: my-hpa
namespace: sg-prod
annotations:
metric-config.object.istio-requests-total.prometheus/per-replica: "true"
metric-config.object.istio-requests-total.prometheus/query: |
sum(rate(istio_requests_total{reporter="destination", destination_workload="<deployment-name-here>"}[2m]))
spec:
minReplicas: 10
maxReplicas: 20
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: <deployment-name-here>
metrics:
- type: Object
object:
metricName: istio-requests-total
target:
apiVersion: v1
kind: Pod
name: <deployment-name-here>
targetValue: 20 # adjust the QPS you want
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment