<p>I am trying to configure kubernetes horizontal pod autoscaling. The definition of my deployment is <a href="http://pastebin.com/bPG1hF2a" rel="nofollow">here</a>. </p>

<p>I start heapster deployment and heapster service like below:</p>

<pre><code># kubectl run heapster --namespace=kube-system --image=gcr.io/google_containers/heapster:v1.0.2 --command -- /heapster --source=kubernetes:http://192.168.122.159:8080?inClusterConfig=false --sink=log
# kubectl expose deployment heapster --port=80 --target-port=8082 --name=heapster --namespace=kube-system
</code></pre>

<p>The hpa is create like this:</p>

<pre><code># kubectl autoscale deployment nginx-rc --max=5 --cpu-percent=25
</code></pre>

<p>The heapster seems to run fine. Here are the <a href="http://pastebin.com/k2dzgnQJ" rel="nofollow">logs</a>.</p>

<p>After all this, the hpa is not receiving any data on CPU utilization. </p>

<pre><code># kubectl describe hpa
Name:               nginx-rc
Namespace:          default
Labels:             &lt;none&gt;
Annotations:            &lt;none&gt;
CreationTimestamp:      Sat, 04 Jun 2016 07:23:03 -0400
Reference:          Deployment/nginx-rc/scale
Target CPU utilization:     25%
Current CPU utilization:    &lt;unset&gt;
Min replicas:           1
Max replicas:           5
Events:
  FirstSeen LastSeen    Count   From                SubobjectPath   Type        Reason          Message
  --------- --------    -----   ----                -------------   --------    ------          -------
  9m        7s      22  {horizontal-pod-autoscaler }            Warning     FailedGetMetrics    failed to get CPU consumption and request: metrics obtained for 0/1 of pods
  9m        7s      22  {horizontal-pod-autoscaler }            Warning     FailedComputeReplicas   failed to get CPU utilization: failed to get CPU consumption and request: metrics obtained for 0/1 of pods
</code></pre>

<p>Controller manager logs have a recurring line:</p>

<pre><code>Jun 04 07:21:33 master kube-controller-manager[8202]: W0604 07:21:33.079677    8202 horizontal.go:108] Failed to reconcile nginx-rc: failed to compute desired number of replicas based on CPU utilization for Deployment/default/nginx-rc: failed to get CPU utilization: failed to get CPU consumption and request: metrics obtained for 0/1 of pods
</code></pre>

<p>Can someone point out the nature of the problem here?</p>

<p>Most likely the problem is that you're not running DNS in your cluster.</p>

<p>HPA currently uses heapster service name to read metrics. You have properly created it, but HPA controller cannot resolve service name to IP address as there's not DNS in your cluster.</p>

<p>I have create issue <a href="https://github.com/kubernetes/kubernetes/issues/27044" rel="nofollow">https://github.com/kubernetes/kubernetes/issues/27044</a> to have more informative events that would help the user/admin understand the problem better.</p>
