<p>In the official Kubernetes documentation:</p>
<p><a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/</a></p>
<p>We can see the following:</p>
<p><em>This example requires a running Kubernetes cluster and kubectl, version 1.2 or later. Metrics server monitoring needs to be deployed in the cluster to provide metrics through the Metrics API. Horizontal Pod Autoscaler uses this API to collect metrics. To learn how to deploy the metrics-server, see the metrics-server documentation.
To specify multiple resource metrics for a Horizontal Pod Autoscaler, you must have a Kubernetes cluster and kubectl at version 1.6 or later. To make use of custom metrics, your cluster must be able to communicate with the API server providing the custom Metrics API. Finally, to use metrics not related to any Kubernetes object you must have a Kubernetes cluster at version 1.10 or later, and you must be able to communicate with the API server that provides the external Metrics API. See the Horizontal Pod Autoscaler user guide for more details.</em></p>
<p>In order to verify I can &quot;make use of custom metrics&quot;, I ran:</p>
<p><code>kubectl get metrics-server</code></p>
<p>And got the result: <code>error: the server doesn't have a resource type &quot;metrics-server&quot;</code></p>
<p>May I ask what can I do to verify &quot;Metrics server monitoring needs to be deployed in the cluster&quot; please?</p>
<p>Thank you</p>

<p>The actual behavior behind the <code>kubectl</code> is to send an API request to a particular endpoint in the Kubernetes API server. There are a couple of predefined objects coming along with <code>kubectl</code>. But if you have some endpoints that are not defined with <code>kubectl</code>, you can use the flag <code>--raw</code> to send the request to API server.</p>
<p>In your case, you can checkout the built-in metrics with this command.</p>
<pre><code>&gt; kubectl get --raw  /apis/metrics.k8s.io
{&quot;kind&quot;:&quot;APIGroup&quot;,&quot;apiVersion&quot;:&quot;v1&quot;,&quot;name&quot;:&quot;metrics.k8s.io&quot;,&quot;versions&quot;:[{&quot;groupVersion&quot;:&quot;metrics.k8s.io/v1beta1&quot;,&quot;version&quot;:&quot;v1beta1&quot;}],&quot;preferredVersion&quot;:{&quot;groupVersion&quot;:&quot;metrics.k8s.io/v1beta1&quot;,&quot;version&quot;:&quot;v1beta1&quot;}}
</code></pre>
<p>You will get the JSON response from <code>kubectl</code>. Then, you can follow the path under the response to query your target resources. In my case, in order to get the actual metrics, I will need to use this command.</p>
<pre><code>&gt; kubectl get --raw /apis/metrics.k8s.io/v1beta1/pods
</code></pre>
<p>For this metrics endpoint, it refers to the built-in metrics. They are CPU and memory. If you want to use the custom metrics, you will need to install the prometheus, prometheus adaptor and corresponding exporter depending on your application. For the custom metrics verification, you can go to the following endpoint.</p>
<pre><code>&gt; kubectl get --raw /apis/custom.metrics.k8s.io
</code></pre>
