<p>I need to create a deployment descriptor &quot;A&quot; yaml in which I can find the endpoint IP address of a pod (that belongs to a deployment &quot;B&quot;) . There is an option to use Downward API but I don't know if I can use it in that case.</p>

<p>What you are looking for is an <code>Headless service</code> (see <a href="https://kubernetes.io/docs/concepts/services-networking/service/#headless-services" rel="nofollow noreferrer">documentation</a>).</p>
<p>With an headless service, the service will not have an own IP address. If you specify a selector for the service, the DNS service will return the pods' IP when you query the service's name.</p>
<p>Quoting the documentation:</p>
<blockquote>
<p>For headless Services that define selectors, the endpoints controller
creates Endpoints records in the API, and modifies the DNS
configuration to return A records (IP addresses) that point directly
to the Pods backing the Service.</p>
</blockquote>
<p>In order to create an headless service, simply set the <code>.spec.clusterIP</code> to <code>None</code> and specify the selector as you would normally do with a traditional service.</p>
