<p>I plan to deploy 2 kubernetes pods with a NodePort service to expose them into the network. Now i want pod 1 be able to access the pod 2 by his service. </p>

<p>The Problem is i write the Deployment files and i don't know the ip address  pod 2 will get from the cluster, but i need to set the address into the file from pod 1 wiva a env. variable. 
Is there a other way in a kubernetes cluster to make them accessible by sth. like the name of the service or sth. like this?</p>

<p>failed to google for this case, and hope anyone of you can give me a hint.</p>

<p>greetings,
Martin.</p>

Martin Mali
<p>All kubernetes resources should be referenced by the kubeDNS, you should be able to use the name of the resource to communicate between pods.</p>

<p>You should be able to make it work with something like this: <code>SERVICENAME.SERVICENAMESPACE:PORT</code> and it can be used in an ENV variable without issue.</p>

<p>Hope this answer the question.</p>
