# Kubernetes Autoscale based on Prometheus matrics

**URL:** <https://discuss.kubernetes.io/t/kubernetes-autoscale-based-on-prometheus-matrics/16375>\
**Category:** General Discussions\
**Created:** [June 16, 2021, 12:24pm UTC](https://discuss.kubernetes.io/t/kubernetes-autoscale-based-on-prometheus-matrics/16375 "2021-06-16T12:24:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sachin\_Agarwal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/sachin_agarwal/32/7943_2.png) [@Sachin\_Agarwal](https://discuss.kubernetes.io/u/Sachin_Agarwal)\
**Post date:** [June 16, 2021, 12:24pm UTC](https://discuss.kubernetes.io/t/kubernetes-autoscale-based-on-prometheus-matrics/16375/1 "2021-06-16T12:24:19Z")

</div>

Can anyone help me to below use case. I have kubernetes and have one pod which has service running and the service is using websocket communication to connect now I wanted to ScaleUp and Scaledown pods based on no of websocket connection… I am using prometeus to get the no of active connection for pod but how do i use prometeus matrics to apply on kubernetes to autoscale??

---

<div class="post-metadata">

**Author:** ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)\
**Post date:** [June 16, 2021, 12:42pm UTC](https://discuss.kubernetes.io/t/kubernetes-autoscale-based-on-prometheus-matrics/16375/2 "2021-06-16T12:42:52Z")

</div>

Theres a bit of infrastructure and other components you need to setup in addition to prometheus -

I did a brief overview of it here:  
https://www.youtube.com/embed/MX0YRlo1dYE?feature=oembed&wmode=opaque&list=PLxNYxgaZ8Rscf-XJ5VfXgbDAk1vL4xaMl

Here are a few other links that might help as well:

- [HPA: Support for Custom Metrics](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics)
- [HPA: Autoscaling on Multiple Metrics and Custom Metrics](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-multiple-metrics-and-custom-metrics)

---

<div class="post-metadata">

**Author:** ![Sachin\_Agarwal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/sachin_agarwal/32/7943_2.png) [@Sachin\_Agarwal](https://discuss.kubernetes.io/u/Sachin_Agarwal)\
**Post date:** [June 16, 2021, 1:28pm UTC](https://discuss.kubernetes.io/t/kubernetes-autoscale-based-on-prometheus-matrics/16375/3 "2021-06-16T13:28:26Z")

</div>

I will have a look.

---

<div class="post-metadata">

**Author:** ![dhiraj\_kumar1](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/dhiraj_kumar1/32/11760_2.png) [@dhiraj\_kumar1](https://discuss.kubernetes.io/u/dhiraj_kumar1)\
**Post date:** [February 3, 2023, 3:33pm UTC](https://discuss.kubernetes.io/t/kubernetes-autoscale-based-on-prometheus-matrics/16375/4 "2023-02-03T15:33:31Z")

</div>

@Sachin_Agarwal

I am nodejs based websocket application for real-time chatting. I have deployed on aks and using application gateway ingress but socket is not connecting, i am getting 502 error.

If you have solution or blog then please share with me.
