<p>My pod scaler fails to deploy, and keeps giving an error of FailedGetResourceMetric:</p>
<pre class="lang-sh prettyprint-override"><code>Warning  FailedComputeMetricsReplicas  6s    horizontal-pod-autoscaler  failed to compute desired number of replicas based on listed metrics for Deployment/default/bot-deployment: invalid metrics (1 invalid out of 1), first error is: failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API
</code></pre>
<p>I have ensured to install metrics-server as you can see when I run the the following command to show the metrics-server resource on the cluster:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get deployment metrics-server -n kube-system
</code></pre>
<p>It shows this:
<a href="https://i.stack.imgur.com/kB5ni.png" rel="nofollow noreferrer">metrics-server</a></p>
<p>I also set the <code>--kubelet-insecure-tls</code> and <code>--kubelet-preferred-address-types=InternalIP</code> options in the <code>args</code> section of the metrics-server manifest file.</p>
<p>This is what my deployment manifest looks like:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: bot-deployment
  labels:
    app: bot
spec:
  replicas: 1
  selector:
    matchLabels:
      app: bot
  template:
    metadata:
      labels:
        app: bot
    spec:
      containers:
      - name: bot-api
        image: gcr.io/&lt;repo&gt;
        ports:
        - containerPort: 5600
        volumeMounts:
        - name: bot-volume
          mountPath: /core
      - name: wallet
        image: gcr.io/&lt;repo&gt;
        ports:
        - containerPort: 5000
        resources:
          requests:
            cpu: 800m
          limits:
            cpu: 1500m
        volumeMounts:
        - name: bot-volume
          mountPath: /wallet_
      volumes:
      - name: bot-volume
        emptyDir: {}
</code></pre>
<p>The specifications for my pod scaler is shown below too:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: bot-scaler
spec:
  metrics:
    - resource:
        name: cpu
        target:
          averageUtilization: 85
          type: Utilization
      type: Resource
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: bot-deployment
  minReplicas: 1
  maxReplicas: 10
</code></pre>
<p>Because of this the <code>TARGET</code> options always remains as /80%. Upon introspection, the HPA makes that same complaint over and over again, I have tried all options, that I have seen on some other questions, but none of them seem to work. I have also tried uninstalling and reinstalling the metrics-server many times, but it doesn't work.</p>
<p>One thing I notice though, is that the metrics-server seems to shut down after I deploy the HPA manifest, and it fails to start. When i check the state of the metrics-server the <code>READY</code> option shows 0/1 even though it was initially 1/1. What could be wrong?</p>
<p>I will gladly provide as much info as needed. Thank you!</p>

CuriousPaul
<p>Looks like your bot-api is missing it's resource request and limit. your wallet has them though. the hpa uses all the resources in the pod to calculate the utilization</p>
