<p>I have managed to install Prometheus and it's adapter and I want to use one of the pod metrics for autoscaling</p>
<pre><code> kubectl get --raw &quot;/apis/custom.metrics.k8s.io/v1beta1&quot; | jq . |grep &quot;pods/http_request&quot;.
      &quot;name&quot;: &quot;pods/http_request_duration_milliseconds_sum&quot;,
      &quot;name&quot;: &quot;pods/http_request&quot;,
      &quot;name&quot;: &quot;pods/http_request_duration_milliseconds&quot;,
      &quot;name&quot;: &quot;pods/http_request_duration_milliseconds_count&quot;,
      &quot;name&quot;: &quot;pods/http_request_in_flight&quot;,
</code></pre>
<p>Checking api I want to use <code>pods/http_request</code> and added it to my HPA configuration</p>
<pre><code>---
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: app
  namespace: app
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: app
  minReplicas: 4
  maxReplicas: 8
  metrics:
 
  - type: Pods
    pods:
      metric:
        name: http_request
      target:
        type: AverageValue
        averageValue: 200

</code></pre>
<p>After applying the yaml and check the hpa status it shows up as <code>&lt;unkown&gt;</code></p>
<pre><code>$ k apply -f app-hpa.yaml
$ k get hpa
NAME                   REFERENCE                         TARGETS                                       
app           Deployment/app           306214400/2000Mi, &lt;unknown&gt;/200 + 1 more...   
</code></pre>
<p>But when using other pod metrics such as <code>pods/memory_usage_bytes</code> the value is properly detected</p>
<p>Is there a way to check the proper values for this metric? and how do I properly add it for my hpa configuration</p>
<p>Reference <a href="https://www.ibm.com/support/knowledgecenter/SSBS6K_3.2.0/manage_cluster/hpa.html" rel="nofollow noreferrer">https://www.ibm.com/support/knowledgecenter/SSBS6K_3.2.0/manage_cluster/hpa.html</a></p>

Ryan Clemente
<p>1st deploy metrics server, it should be up and running.</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml 
</code></pre>
<p>Then in a few sec. metrics server deployed. check HPA it should resolved.</p>
<pre class="lang-sh prettyprint-override"><code>$ kubectl get deployment -A

NAMESPACE     NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
.
.
kube-system   metrics-server       1/1     1            1           34s


$ kubectl get hpa
NAME                  REFERENCE                       TARGETS   MINPODS   MAXPODS   REPLICAS   AGE
ha-xxxx-deployment   Deployment/xxxx-deployment   1%/5%     1         10        1          6h46m
</code></pre>
