title: HPA cannot read metric value (CPU utilization) on GKE
body: <p>I'm working on Google Kubernetes Engine on a single cluster.
  The cluster automatically scales the number of nodes.
  I have three created a Deployment and set up the auto-scaling policy using the website (Workloads -&gt; Deployment -&gt; Actions -&gt; Auto-scaling), so not manually writing the YAML configuration.
  Based on an official <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/horizontal-pod-autoscaling?hl=it" rel="nofollow noreferrer">guide</a>, I did not make any mistake.</p>
  <blockquote>
  <p>If you do not specify requests, you can autoscale based only on the
  absolute value of the resource's utilization, such as milliCPUs for
  CPU utilization.</p>
  </blockquote>
  <p>The following is the full deployment YAML:</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    labels:
      app: student
    name: student
    namespace: ulibretto
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: student
    strategy:
      rollingUpdate:
        maxSurge: 25%
        maxUnavailable: 25%
      type: RollingUpdate
    template:
      metadata:
        labels:
          app: student
      spec:
        containers:
          - env:
              - name: CLUSTER_HOST
                valueFrom:
                  configMapKeyRef:
                    key: CLUSTER_HOST
                    name: shared-env-vars
              - name: BIND_HOST
                valueFrom:
                  configMapKeyRef:
                    key: BIND_HOST
                    name: shared-env-vars
              - name: TOKEN_TIMEOUT
                valueFrom:
                  configMapKeyRef:
                    key: TOKEN_TIMEOUT
                    name: shared-env-vars
            image: gcr.io/ulibretto/github.com/ulibretto/studentservice
            imagePullPolicy: IfNotPresent
            name: studentservice-1
  ---
  apiVersion: autoscaling/v2beta1
  kind: HorizontalPodAutoscaler
  metadata:
    labels:
      app: student
    name: student-hpa-n3bp
    namespace: ulibretto
  spec:
    maxReplicas: 100
    metrics:
      - resource:
          name: cpu
          targetAverageUtilization: 80
        type: Resource
    minReplicas: 1
    scaleTargetRef:
      apiVersion: apps/v1
      kind: Deployment
      name: student
  ---
  apiVersion: v1
  kind: Service
  metadata:
    annotations:
      cloud.google.com/neg: '{&quot;ingress&quot;:true}'
    labels:
      app: student
    name: student-ingress
    namespace: ulibretto
  spec:
    clusterIP: 10.44.5.59
    ports:
      - port: 5000
        protocol: TCP
        targetPort: 5000
    selector:
      app: student
    sessionAffinity: None
    type: ClusterIP
  </code></pre>
  <p>The problem is that the HPA does not see the metric (average CPU utilization), which is really strange (see image).
  <a href="https://i.stack.imgur.com/3pSTJ.png" rel="nofollow noreferrer">HPA cannot read metric value</a></p>
  <p>What I am missing?</p>