<p>Currently, I obtaine various information from the GoogleCloudPlatform management console screen, but in the future I would like to obtain it using API.
The information obtained is as follows. </p>

<pre><code>Kubernetes Engine&gt;Clusters&gt;Cluster Size
Kubernetes Engine&gt;Workloads&gt;Pods
</code></pre>

<p>Please teach the API corresponding to each information acquisition.</p>

<p>GKE UI under the hood calls Kubernetes API to get information and show in UI.
You can use kubectl to query Kubernetes API to get that information.</p>

<pre><code>kubectl get nodes
kubectl get pods
</code></pre>

<p>If you turn on the verbose mode in kubectl then it will show what REST API its calling on the kubernetes api server.</p>

<pre><code>kubectl --v=8 get nodes
kubectl --v=8 get pods
</code></pre>

<p>The REST API for nodes and pods are </p>

<pre><code>GET https://kubernetes-api-server-endpoint:6443/api/v1/nodes?limit=500
GET https://kubernetes-api-server-endpoint:6443/api/v1/namespaces/default/pods?limit=500
</code></pre>

<p>Here is the <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl" rel="nofollow noreferrer">doc</a> on how to configure Kubectl to connect with GKE.</p>

<p>Here is the <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/" rel="nofollow noreferrer">doc</a> from kubernetes on different ways to access Kubernetes API.</p>

<p>You can also use <a href="https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#using-kubectl-proxy-1" rel="nofollow noreferrer">kubectl proxy</a> for trying it out.</p>

<p>Remember to call above rest apis you need to authenticate to kubernetes api server either with a certificate or with a bearer token.</p>
