<p>When you specify and Horizontal Pod Autoscaler in Kubernetes for example with <code>targetCPUUtilizationPercentage</code> of 50, what does Kubernetes use to calculate the CPU ratio, the request or the limit of the container?</p>

<p>So for example, with a <code>request=250</code> and <code>limit=500</code> and you want to scale up when is half its limit:</p>

<ul>
<li>If it used the <code>request</code>, I would put the target to 100% at least as it can raise to 200%.</li>
<li>If it used the <code>limit</code>, I would use target = 50% as 100% would mean the limit is reached.</li>
</ul>

PhoneixS
<p>targetCPUUtilizationPercentage of 50 means that if average CPU utilization across all Pods goes up above 50% then HPA would scale up the deployment and if the average CPU utilization across all Pods goes below 50% then HPA would scale down the deployment if the number of replicas are more than 1</p>

<p>I just checked the code and found that targetUtilization percentage calculation uses resource request.
refer below code</p>

<pre><code>currentUtilization = int32((metricsTotal * 100) / requestsTotal)
</code></pre>

<p>here is the link 
<a href="https://github.com/kubernetes/kubernetes/blob/v1.9.0/pkg/controller/podautoscaler/metrics/utilization.go#L49" rel="noreferrer">https://github.com/kubernetes/kubernetes/blob/v1.9.0/pkg/controller/podautoscaler/metrics/utilization.go#L49</a></p>
