<p>I have Kubernetes v1.12.1 installed on my cluster. 
I downloaded the metrics-server from the following repo:
<a href="https://github.com/kubernetes-incubator/metrics-server" rel="nofollow noreferrer">https://github.com/kubernetes-incubator/metrics-server</a></p>

<p>and then run the following command:</p>

<pre><code>kubectl create -f metrics-server/deploy/1.8+/
</code></pre>

<p>and then I tried autoscaling a deployment using:</p>

<pre><code>kubectl autoscale deployment example-app-tier --min 1 --max 3 --cpu-percent 70 --spacename example
</code></pre>

<p>but the targets here shows unkown/70% </p>

<pre><code>kubectl get hpa --spacename example
NAMESPACE   NAME               REFERENCE                     TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
example example-app-tier   Deployment/example-app-tier   &lt;unknown&gt;/70%   1         3         1          3h35m
</code></pre>

<p>and when I try running the kubectl top nodes or pods I get an error saying:</p>

<pre><code>error: Metrics not available for pod default/pi-ss8j6, age: 282h48m5.334137739s
</code></pre>

<p>So I'm looking for any tutorial that helps me step by step enabling autoscaling using metrics-server or Prometheus (and not Heapster as it is deprecated and will not be supported anymore)</p>

<p>Thank you!</p>

<p>you need to register your metrics server with API server and make sure they communicate. </p>

<p><a href="https://github.com/kubernetes/kubernetes/issues/59438" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/issues/59438</a></p>

<p>If it is done already , you need to check the help for the kubectl top command in your version of k8s , the command may default to use heapster , and you may need to tell it to use the new service instead.</p>

<p><a href="https://github.com/kubernetes/kubernetes/pull/56206" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/pull/56206</a></p>

<p>from the help command it looks like it is not yet ported to new metric server and still looking for heapster by default.</p>

<pre><code>C02W84XMHTD5:tmp iahmad$ kubectl top node --help
Display Resource (CPU/Memory/Storage) usage of nodes. 

The top-node command allows you to see the resource consumption of nodes.

Aliases:
node, nodes, no

Examples:
  # Show metrics for all nodes
  kubectl top node

  # Show metrics for a given node
  kubectl top node NODE_NAME

Options:
      --heapster-namespace='kube-system': Namespace Heapster service is located in
      --heapster-port='': Port name in service to use
      --heapster-scheme='http': Scheme (http or https) to connect to Heapster as
      --heapster-service='heapster': Name of Heapster service
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l
key1=value1,key2=value2)

Usage:
  kubectl top node [NAME | -l label] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).
</code></pre>

<p><strong>note:</strong> I am using 1.10 , maybe in your version , the options are different</p>
