<p>Within same stateful set afaik you can interact between particular pods just by referencing it directly, like this - <code>pod-{0..N-1}.my_service.my_namespace.svc.cluster.local</code>.
(some more info here: <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-network-id" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-network-id</a>).</p>
<p>However in my case I have 2 different stateful sets, and I want to be able <code>statefullset1-pod-0</code> from 1st stateful set to interact with <code>statefullset2-pod-0</code> from 2nd stateful set(and also <code>statefullset1-pod-1</code> with <code>statefullset2-pod-1</code>, and so on). Is it possible? If yes, can you please provide example configuration?</p>

Ruslan Akhundov
<blockquote>
<p>However in my case I have 2 different stateful sets, and I want to be able statefullset1-pod-0 from 1st stateful set to interact with statefullset2-pod-0 from 2nd stateful set(and also statefullset1-pod-1 with statefullset2-pod-1, and so on). Is it possible? If yes, can you please provide example configuration?</p>
</blockquote>
<p>Yes, your apps can access other <code>StatefulSet</code> as it access any other Service in the cluster, use the DNS name of the Service. E.g. if you have created Service <code>statefullset2-pod-0</code> in the same namespace, you can access it with <code>http://statefullset2-pod-0</code> if it is a http-service.</p>
<p>Remember, for StatefulSet, you are responsilbe to create the Pod-identity services yourself.</p>
<p>From the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSet documentation</a>:</p>
<blockquote>
<p>StatefulSets currently require a Headless Service to be responsible for the network identity of the Pods. You are responsible for creating this Service.</p>
</blockquote>
