question

ShreyasArani-1167 avatar image
0 Votes"
ShreyasArani-1167 asked ShreyasArani-1167 answered

Pod scaling based on the http requests

Hi how can I achieve pod scaling based on the number of http requests for a particular pod. I know that we need to use custom metrics and prometheus adapter.

can anyone provide me a documentation or link which describes about scaling based on http requests.

azure-kubernetes-service
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

shivapatpi-MSFT avatar image
0 Votes"
shivapatpi-MSFT answered

Hello @ShreyasArani-1167 ,
Thanks for your query. Yes you are correct - need to set-up custom metrics using Prometheus and Prometheus Adapter.
You will have to rely on HPA (Horizontal Pod Autoscaler)
Can you take a look at the article:
https://vunvulearadu.blogspot.com/2018/12/auto-scaling-dimensions-inside-azure.html

and sample YAML file of HPA based upon HPTT Request:

kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2alpha1
metadata:
name: rv-epi-card-hpa
spec:
scaleTargetRef:
kind: Deployment
name: rv-epi-card
minReplicas: 2
maxReplicas: 8
metrics:
- type: Object
object:
target:
kind: Service
name: sample-metrics-app
metricName: http_request
targetValue: 256


Couple of additional articles explaining the correlation between Prometheus vs Prometheus adapter and how the data is being consumed by Customer Metrics API
https://learnk8s.io/autoscaling-apps-kubernetes

Detailed notes about Prometheus:

https://prometheus.io/docs/practices/instrumentation/



Let us know if the above articles helps out in the implementation.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ShreyasArani-1167 avatar image
0 Votes"
ShreyasArani-1167 answered

Hi @shivapatpi-MSFT can you provide a documentation where they have explained how to install and configure prometheus and how they have used the custom metrics. Also how they have installed and configured prometheus adapter to scrape http requests on a particular pod. Can you send me a working example which covers all these aspects.

Thanks in adavance

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.