<p>I have a scenario where I have a Kubernetes cluster of three nodes. Now there is a service(say <code>testService</code>) running on the cluster(any one of the three nodes). I would like to know if there is any way through which I can get the IP of the node on which the service is running by using the kubernetes API.</p>

<p>I looked through the documentation and all I could find was APIs to get the status/names of the services.</p>

<p><strong>Edit</strong>: There is a UI page which targets the service. The problem is that on a new deployment the service can be scheduled on either of the three nodes.</p>

<p>You should be able to do it with the <a href="https://github.com/kubernetes-client/java" rel="nofollow noreferrer">Kubernetes Java API</a>. </p>

<p>You can basically get it with a <em>describe service </em> call and picking up the endpoints of your service. An example endpoint output would look like something this:</p>

<pre><code>192.168.1.1:8888,192.168.2.2:8888
</code></pre>
