<p>I create a deployment and one HPA for that deployment (single node minikube cluster). But when I run the <code>kubectl get hpa</code>, it shows the targets as unknown (screenshot below)</p>

<pre><code>NAME       REFERENCE             TARGETS        MINPODS   MAXPODS   REPLICAS   AGE
producer   Deployment/producer   &lt;unknown&gt;/1%   1         3         1          42m
</code></pre>

<p>Below is the deployment.yaml file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.1.0 (36652f6)
  creationTimestamp: null
  labels:
    io.kompose.service: producer
  name: producer
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: producer
    spec:
      containers:
      - image: &lt;image name&gt;
        name: producer
        ports:
        - containerPort: 8090
        env:
        - name: mongoUrl
          value: mongodb://mongo:27017
        - name: mongoHost
          value: mongo
        - name: mongoPort
          value: "27017"
        resources:
          requests:
            cpu: 10m
         resources: {}
       restartPolicy: Always
status: {}
</code></pre>

<p>I run <code>kubectl autoscale deployment producer --cpu-percent=1 --min=1 --max=3</code> command for setting the autoscaler for the producer deployment. Below is the output for <code>kubectl describe hpa</code> :</p>

<pre><code>Type     Reason                        Age                 From                       Message
  ----     ------                        ----                ----                       -------
  Warning  FailedComputeMetricsReplicas  43m (x13 over 49m)  horizontal-pod-autoscaler  failed to get cpu utilization: missing request for cpu on container producer in pod default/producer-c7dd566f6-69gbq
  Warning  FailedGetResourceMetric       4m (x91 over 49m)   horizontal-pod-autoscaler  missing request for cpu on container producer in pod default/producer-c7dd566f6-69gbq
</code></pre>

<p>I have already enabled the <code>heapster</code> and <code>metrics-server</code> addons on minikube and waiting the hpa is running from the last 30 minutes. </p>

<p>Logs from <code>kube-controller-manager</code> in minikube:</p>

<pre><code>{"log":"I0912 10:36:40.806224       1 event.go:218] Event(v1.ObjectReference{Kind:\"HorizontalPodAutoscaler\", Namespace:\"default\", Name:\"producer\", UID:\"135d0ebc-b671-11e8-a19f-080027646864\", APIVersion:\"autoscaling/v2beta1\", ResourceVersion:\"71101\", FieldPath:\"\"}): type: 'Warning' reason: 'FailedGetResourceMetric' missing request for cpu on container producer in pod default/producer-c7dd566f6-w8zcd\n","stream":"stderr","time":"2018-09-12T10:36:40.80645916Z"}
{"log":"I0912 10:36:40.806511       1 event.go:218] Event(v1.ObjectReference{Kind:\"HorizontalPodAutoscaler\", Namespace:\"default\", Name:\"producer\", UID:\"135d0ebc-b671-11e8-a19f-080027646864\", APIVersion:\"autoscaling/v2beta1\", ResourceVersion:\"71101\", FieldPath:\"\"}): type: 'Warning' reason: 'FailedComputeMetricsReplicas' failed to get cpu utilization: missing request for cpu on container producer in pod default/producer-c7dd566f6-w8zcd\n","stream":"stderr","time":"2018-09-12T10:36:40.806564094Z"}
</code></pre>

<p>Output from <code>kubectl top nodes</code></p>

<pre><code>NAME       CPU(cores)   CPU%      MEMORY(bytes)   MEMORY%   
minikube   336m         16%       1518Mi          19%    
</code></pre>

<p>I have tried setting the <code>horizontal-pod-autoscaler-use-rest-clients=false</code> for <code>kube-controller-manager</code>, still facing the same issue. </p>

Lakshya Garg
<p>The problem was with my <code>producer-deployment.yaml</code> as I had overwritten the resources request to be null again by writing the line: <code>resources: {}</code> after </p>

<pre><code>resources:
    requests:
        cpu: 10m
</code></pre>

<p>This made my resources request null and that is why heapster was showing <code>missing request for cpu on container producer</code>.</p>

<p>removing the line <code>resources: {}</code> form <code>producer-deployment.yaml</code> solved the issue. </p>
