<p>I have a single node K8s cluster in Azure using AKS. I created a deployment and a service using a simple command:</p>

<p><code>kubectl run php-apache --image=pilchard/hpa-example:latest --requests=cpu=200m,memory=300M --expose --port=80</code></p>

<p>And enabled HPA via command:
<code>kubectl autoscale deployment php-apache --cpu-percent=10 --min=1 --max=15</code></p>

<p>Upon running <code>kubectl describe hpa php-apache</code>, I see an error saying:</p>

<pre><code>horizontal-pod-autoscaler  unable to get metrics for resource cpu: unable to fetch metrics from API: the server could not find the requested resource (get pods.metrics.k8s.io)
horizontal-pod-autoscaler  failed to get cpu utilization: unable to get metrics for resource cpu: unable to fetch metrics from API: the server could not find the requested resource (get pods.metrics.k8s.io)
</code></pre>

<p>And CPU metric is unknown upon running <code>kubectl get hpa</code>. Any help would be really appreciated.</p>

<p>My AKS kube version is <code>v1.9.11</code>.</p>

<p>You either need to install the <a href="https://github.com/kubernetes/heapster" rel="nofollow noreferrer">heapster</a>(Deprecated) or the <a href="https://github.com/kubernetes-incubator/metrics-server" rel="nofollow noreferrer">metrics-server</a> minimally to be able to use an <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/" rel="nofollow noreferrer">HPA</a>.</p>

<p>This provides the minimum set of CPU and Memory metrics to be able to autoscale. A good way to see if you have either installed is that if you get this kind output from <code>kubectl top pod</code>:</p>

<pre><code>$ kubectl top pod
NAME                        CPU(cores)   MEMORY(bytes)
http-svc-xxxxxxxxxx-xxxxx   1m           7Mi
myapp-pod                   0m           53Mi
sleep-xxxxxxxxxx-xxxxx      4m           27Mi
</code></pre>
