<p>I want to fetch cluster id using java spring kubernetes api. Is there a way to get it programmatically like we get pod information using below:</p>
<pre><code>ApiClient client  = Config.defaultClient();
CoreV1Api api = new CoreV1Api(client);
String continuationToken = null;
V1PodList items = api.listPodForAllNamespaces(null, continuationToken, null, null, 10, null, null, null, 10, false);
</code></pre>

shiva kumar
<p>In <strong><a href="https://docs.spring.io/spring-cloud-open-service-broker/docs/3.1.0.RELEASE/apidocs/org/springframework/cloud/servicebroker/model/KubernetesContext.html" rel="nofollow noreferrer">kubernetes spring api documentation</a></strong> there is a detailed explanation provided for KubernetesContext class. There is a method called <code>getClusterid()</code> which will return the cluster id. Following is the explanation provided in the documentation:</p>
<blockquote>
<p><strong>getClusterid</strong></p>
<p>public String getClusterid()</p>
<p>Retrieve the kubernetes clusterid from the collection of platform.</p>
<p>properties</p>
<p><strong>Returns:</strong>
the clusterid</p>
</blockquote>
<p>Note: The above information is provided by referring to the <a href="https://docs.spring.io/spring-cloud-open-service-broker/docs/3.1.0.RELEASE/apidocs/org/springframework/cloud/servicebroker/model/KubernetesContext.html" rel="nofollow noreferrer">official documentation</a>.</p>
