<p>I have a pod running in a statefulset but it needs to know the hostname or address of all pods running in another statefulset to communicate with them. The second statefulset is being created by a separate helm chart. Can the pod work this out dynamically? Can I inject this information into the pod through an env similar to setting <code>.Status.ip</code>?</p>
<p>Edit: Each statefulSet has its own headless service</p>

atlantis.pd
<p>As discussed in the comments, the way to go here is to use a service-resource as this will give you a static DNS within the cluster to reach all the pods that a targeted by that service.</p>
<p>The DNS for the service is:</p>
<ul>
<li>the services name if you access it from within the same namespace</li>
<li><code>&lt;my-service-name&gt;.&lt;namespace-name&gt;.svc.cluster.local</code> if you access it from another namespace, and where <code>cluster.local</code> is the clusters domain that might differ from cluster to cluster depending on the clusters configuration</li>
</ul>
<p>If you further need more configuration options, e.g. when you want to deploy your chart into different cloud environments where the clusters-domain might actually differ, you can use kustomize.io to adjust your configuration at apply time.</p>
