<p>I am using <a href="https://github.com/kubernetes-client/java" rel="nofollow noreferrer">official java client</a> of Kubernetes to request resources of the cluster such as Pods, Deployment and so on.</p>

<p>But unfortunately I found that it seems there is no API to request cluster metrics such as total CPU and Memory used by all pods.</p>

<p>Do you know how to get the cluster metrics using Java client ?</p>

<p>Thanks!</p>

Jerry Zhang
<p>Deploy the <a href="https://github.com/kubernetes-sigs/metrics-server" rel="nofollow noreferrer">metrics-server</a> to the cluster. </p>

<p>You will then have access to query the <code>metrics.k8s.io/v1beta1</code> API for <code>pods</code> and <code>nodes</code> as normal kubernetes resource. You should be able to run <code>kubectl top pod</code> to test.</p>

<p>I don't see any reason why the official java client wouldn't be able to discover these resources, but if it did they are available at the following URL's</p>

<pre><code>https://api-server/apis/metrics.k8s.io/v1beta1/pods
https://api-server/apis/metrics.k8s.io/v1beta1/nodes
</code></pre>
