title: Minikube horizontal pod autoscaling error: unable to get metrics for resource cpu: no metrics returned
body: <p>I'v enabled heapster on minikube</p>
  
  <pre><code>minikube addons start heapster
  </code></pre>
  
  <p>And custom metrics with</p>
  
  <pre><code>minikube start --extra-config kubelet.EnableCustomMetrics=true
  </code></pre>
  
  <p>My deployment looks like</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: kubia
  spec:
    replicas: 1
    template:
      metadata:
        name: kubia
        labels:
          app: kubia
        annotations:
          pod.beta.kubernetes.io/init-containers: '[
              {
                  "name": "setup",
                  "image": "busybox",
                  "imagePullPolicy": "IfNotPresent",
                  "command": ["sh", "-c", "echo \"{\\\"endpoint\\\": \\\"http://$POD_IP:8080/metrics\\\"}\" &gt; /etc/custom-metrics/definition.json"],
                  "env": [{
                    "name": "POD_IP",
                    "valueFrom": {
                      "fieldRef": {
                        "apiVersion": "v1",
                        "fieldPath": "status.podIP"
                      }
                    }
                  }],
                  "volumeMounts": [
                      {
                          "name": "config",
                          "mountPath": "/etc/custom-metrics"
                      }
                  ]
              }
          ]'
      spec:
        containers:
        - image: luksa/kubia:qps
          name: nodejs
          ports:
            - containerPort: 8080
          volumeMounts:
          - name: config
            mountPath: /etc/custom-metrics
          resources:
            requests:
              cpu: 100m
        volumes:
        - name: config
          emptyDir:
  </code></pre>
  
  <p>My hpa looks like</p>
  
  <pre><code>apiVersion: autoscaling/v1
  kind: HorizontalPodAutoscaler
  metadata:
    name: kubia
    annotations:
      alpha/target.custom-metrics.podautoscaler.kubernetes.io: '{"items":[{"name":"qps", "value": "20"}]}'
  spec:
    maxReplicas: 5
    minReplicas: 1
    scaleTargetRef:
      apiVersion: extensions/v1beta1
      kind: Deployment
      name: kubia
    targetCPUUtilizationPercentage: 1000000
  </code></pre>
  
  <p>However I get target unknown</p>
  
  <pre><code>jonathan@ubuntu ~&gt; kubectl get hpa
  NAME      REFERENCE          TARGETS                MINPODS   MAXPODS   REPLICAS   AGE
  kubia     Deployment/kubia   &lt;unknown&gt; / 1000000%   1         5         1          31m
  </code></pre>
  
  <p>And the following warnings from the hpa</p>
  
  <pre><code>  Warning  FailedGetResourceMetric       27m (x12 over 33m)  horizontal-pod-autoscaler  unable to get metrics for resource cpu: no metrics returned from heapster
    Warning  FailedComputeMetricsReplicas  27m (x12 over 33m)  horizontal-pod-autoscaler  failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from heapster
  </code></pre>