<p>The metrics of the appiservice cannot be queried through the kubectl --raw command.</p>
<pre><code>NAME                                   SERVICE                                AVAILABLE   AGE
v1.                                    Local                                  True        33d
v1.admissionregistration.k8s.io        Local                                  True        33d
v1.apiextensions.k8s.io                Local                                  True        33d
v1.apps                                Local                                  True        33d
v1.authentication.k8s.io               Local                                  True        33d
v1.authorization.k8s.io                Local                                  True        33d
v1.autoscaling                         Local                                  True        33d
v1.batch                               Local                                  True        33d
v1.certificates.k8s.io                 Local                                  True        33d
v1.coordination.k8s.io                 Local                                  True        33d
v1.discovery.k8s.io                    Local                                  True        33d
v1.events.k8s.io                       Local                                  True        33d
v1.monitoring.coreos.com               Local                                  True        4d18h
v1.networking.k8s.io                   Local                                  True        33d
v1.node.k8s.io                         Local                                  True        33d
v1.policy                              Local                                  True        33d
v1.rbac.authorization.k8s.io           Local                                  True        33d
v1.scheduling.k8s.io                   Local                                  True        33d
v1.storage.k8s.io                      Local                                  True        33d
v1alpha1.crd.k8s.amazonaws.com         Local                                  True        33d
v1alpha1.kafka.strimzi.io              Local                                  True        29d
v1alpha1.keda.sh                       Local                                  True        68m
v1alpha1.monitoring.coreos.com         Local                                  True        4d18h
v1beta1.admissionregistration.k8s.io   Local                                  True        33d
v1beta1.apiextensions.k8s.io           Local                                  True        33d
v1beta1.authentication.k8s.io          Local                                  True        33d
v1beta1.authorization.k8s.io           Local                                  True        33d
v1beta1.batch                          Local                                  True        33d
v1beta1.certificates.k8s.io            Local                                  True        33d
v1beta1.coordination.k8s.io            Local                                  True        33d
v1beta1.custom.metrics.k8s.io          monitoring/my-prometheus-adapter       True        25h
v1beta1.discovery.k8s.io               Local                                  True        33d
v1beta1.events.k8s.io                  Local                                  True        33d
v1beta1.extensions                     Local                                  True        33d
v1beta1.external.metrics.k8s.io        keda/keda-operator-metrics-apiserver   True        68m
v1beta1.flowcontrol.apiserver.k8s.io   Local                                  True        33d
v1beta1.kafka.strimzi.io               Local                                  True        29d
v1beta1.metrics.k8s.io                 kube-system/metrics-server             True        26d
v1beta1.networking.k8s.io              Local                                  True        33d
v1beta1.node.k8s.io                    Local                                  True        33d
v1beta1.policy                         Local                                  True        33d
v1beta1.rbac.authorization.k8s.io      Local                                  True        33d
v1beta1.scheduling.k8s.io              Local                                  True        33d
v1beta1.storage.k8s.io                 Local                                  True        33d
v1beta1.vpcresources.k8s.aws           Local                                  True        33d
v1beta2.kafka.strimzi.io               Local                                  True        29d
v2beta1.autoscaling                    Local                                  True        33d
v2beta2.autoscaling                    Local                                  True        33d```


$ kubectl get --raw &quot;/apis/external.metrics.k8s.io/v1beta1&quot;
Error from server (NotFound): the server could not find the requested resource



$ kubectl get --raw &quot;/apis/apps/v1&quot; -v 8
I1201 11:41:09.091623   19776 loader.go:372] Config loaded from file:  C:\Users\---\.kube\config
I1201 11:41:09.116405   19776 round_trippers.go:432] GET https://---.sk1.ap-northeast-2.eks.amazonaws.com/Program%20Files/Git/apis/apps/v1
I1201 11:41:09.116405   19776 round_trippers.go:438] Request Headers:
I1201 11:41:09.116405   19776 round_trippers.go:442]     Accept: application/json, */*
I1201 11:41:09.116405   19776 round_trippers.go:442]     User-Agent: kubectl.exe/v1.21.5 (windows/amd64) kubernetes/aea7bba
I1201 11:41:12.227585   19776 round_trippers.go:457] Response Status: 404 Not Found in 3111 milliseconds
I1201 11:41:12.227585   19776 round_trippers.go:460] Response Headers:
I1201 11:41:12.227585   19776 round_trippers.go:463]     Audit-Id: ---
I1201 11:41:12.227585   19776 round_trippers.go:463]     Cache-Control: no-cache, private
I1201 11:41:12.227585   19776 round_trippers.go:463]     Content-Type: application/json
I1201 11:41:12.227585   19776 round_trippers.go:463]     X-Kubernetes-Pf-Flowschema-Uid: ---
I1201 11:41:12.227585   19776 round_trippers.go:463]     X-Kubernetes-Pf-Prioritylevel-Uid: ---
I1201 11:41:12.227585   19776 round_trippers.go:463]     Content-Length: 1556

I1201 11:41:12.228151   19776 helpers.go:216] server response object: [{
  &quot;metadata&quot;: {},
  &quot;status&quot;: &quot;Failure&quot;,
  &quot;message&quot;: &quot;the server could not find the requested resource&quot;,
  &quot;reason&quot;: &quot;NotFound&quot;,
  &quot;details&quot;: {
    &quot;causes&quot;: [
      {
        &quot;reason&quot;: &quot;UnexpectedServerResponse&quot;,
        &quot;message&quot;: &quot;unknown&quot;
      }
    ]
  },
  &quot;code&quot;: 404
}]


</code></pre>
<p>What is the problem?</p>
<p>I used k8s on EKS with 4 workernode</p>
<p>how can i get metrics from apiservice?</p>
<p>other kubectl commands ex) kubectl get pods, kubectl apply are worked correctly</p>
<p>and kubectl top nodes, pods command worked correctly too.</p>
<p>so i can scale out using HPA with target resource cpu and memory</p>

zxc157
<p>Please do the following:</p>
<ol>
<li>Check if the Metric server is installed or not.</li>
</ol>
<pre><code> kubectl get pods --all-namespaces | grep metrics-server
</code></pre>
<ol start="2">
<li>If it's not running install it using the command.</li>
</ol>
<pre><code>kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
</code></pre>
<ol start="3">
<li>Once running check that you can access the metrics using command</li>
</ol>
<pre><code>kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes/&lt;NODE_NAME&gt; | jq

</code></pre>
