<p>I am looking for pointers on how to autoscale pods based on custom metrics.</p>

<p>As the number of incoming http requests increase, I would like my GKE pods to autoscale to handle the load.</p>

<p>What is the best way to achieve this ?</p>

Varunkumar Manohar
<p>By default, HPA in GKE uses CPU to scale up and down (based on resource requests Vs actual usage). However, you can use custom metrics as well, <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/custom-metrics-autoscaling" rel="nofollow noreferrer">just follow this guide</a>. In your case, have the custom metric track the number of HTTP requests per pod (do not use the number of requests to the LB).</p>

<p>Make sure when using custom metrics, that the value you choose to use will be an average across all pods, this way the number will increase or decrease with the number of pods. If you choose a metric that is no affected by the number of pods you have, your HPA will either always be at the maximum or the minimum number of pods.</p>
