<p>I am trying to test the horizontal pod autoscale feature for my Kubernetes cluster deployed in AWS(using EKS).</p>
<p>I have set Resource as 'CPU' and target type as 'Utilization' and set 'averageUtilization' to 15 in the YAML file.</p>
<p>So technically when the CPU utilization percentage meets the <strong>15%</strong> set percentage, Kubernetes cluster should auto-scale horizontally(add pods automatically). This is an important part of the YAML file:</p>
<pre class="lang-yaml prettyprint-override"><code>    maxReplicas: 11
    metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 15
</code></pre>
<p>I am pumping a lot of HTTP traffic into the Kubernetes cluster, but all pods stabilize at 35% - 36% CPU with 5 or 6 pods and they do not create additional pods to bring down average CPU utilization to 15% (which I set in YAML file as 'averageUtilization').</p>
<p>No matter how much I debug and run tests many times, it's the same case. What am I doing wrong here, am I missing something else?</p>

<p>Did you check that <code>metrics-server</code> is enabled? It is required in order to enable <code>hpa</code>: <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis</a>.</p>
<p>Here's <code>metrics-server</code> doc: <a href="https://github.com/kubernetes-sigs/metrics-server" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/metrics-server</a>. In order to test it quickly and check it solves your issue, you can disable TLS: <code>--kubelet-insecure-tls</code>. In production, you'll need to enable TLS again.</p>
<p>To check that <code>metrics-server</code> is enabled, you can run the <code>kubectl top</code> command. It requires a few seconds to start, because it needs to collect some metrics first.</p>
