<p>Kubernetes not able to find metric-server api.I am using Kubernetes with Docker on Mac. I was trying to do HPA from <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="noreferrer">following example</a>. However, when I execute command <code>kubectl get hpa</code>, My target still was unknown. Then I tried, <code>kubectl describe hpa</code>. Which gave me error like below:</p>
<pre><code>  Name:                                                  php-apache
  Namespace:                                             default
  Labels:                                                &lt;none&gt;
  Annotations:                                           &lt;none&gt;
  CreationTimestamp:                                     Sun, 07 Oct 2018 12:36:31 -0700
  Reference:                                             Deployment/php-apache
  Metrics:                                               ( current / target )
    resource cpu on pods  (as a percentage of request):  &lt;unknown&gt; / 5%
  Min replicas:                                          1
  Max replicas:                                          10
  Conditions:
    Type           Status  Reason                   Message
    ----           ------  ------                   -------
    AbleToScale    True    SucceededGetScale        the HPA controller was able to get the target's current scale
    ScalingActive  False   FailedGetResourceMetric  the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API
  Events:
    Type     Reason                        Age               From                       Message
    ----     ------                        ----              ----                       -------
    Warning  FailedComputeMetricsReplicas  1h (x34 over 5h)  horizontal-pod-autoscaler  failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API
    Warning  FailedGetResourceMetric       1m (x42 over 5h)  horizontal-pod-autoscaler  unable to get metrics for resource cpu: no metrics returned from resource metrics API
</code></pre>
<p>I am using <a href="https://github.com/kubernetes-incubator/metrics-server" rel="noreferrer">metrics-server</a> as suggested in Kubernetes documentation. I also tried doing same just using Minikube. But that also didn't work.</p>
<p>Running <code>kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes</code> outputs :</p>
<pre><code>{
  &quot;kind&quot;: &quot;NodeMetricsList&quot;,
  &quot;apiVersion&quot;: &quot;metrics.k8s.io/v1beta1&quot;,
  &quot;metadata&quot;: {
    &quot;selfLink&quot;: &quot;/apis/metrics.k8s.io/v1beta1/nodes&quot;
  },
  &quot;items&quot;: []
}
</code></pre>

<p>Use official metrics server - <a href="https://github.com/kubernetes-sigs/metrics-server" rel="noreferrer">https://github.com/kubernetes-sigs/metrics-server</a></p>
<p>If you use one master node, run this command to create the <code>metrics-server</code>:</p>
<pre><code>kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
</code></pre>
<p>If you have HA (High availability) cluster, use this:</p>
<pre><code>kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability.yaml
</code></pre>
<p>Then use can use <code>kubectl top nodes</code> or <code>kubectl top pods -A</code> and get something like:</p>
<pre><code>NAME          CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
</code></pre>
