<p>I have a Kubernetes deployment that has 3 replicas. It starts 3 pods which are distributed across a given cluster. I would like to know how to reliably get one pod to contact another pod within the same <code>ReplicaSet</code>.</p>

<p>The deployment above is already wrapped up in a Kubernetes <code>Service</code>. But <code>Services</code> do not cover my use case. I need each instance of my container (each <code>Pod</code>) to start-up a local in memory cache and have these cache communicate/sync with other cache instances running on other <code>Pods</code>. This is how I see a simple distributed cache working on for my service. Pod to pod communication within the same cluster is allowed as per the <a href="https://kubernetes.io/docs/concepts/cluster-administration/networking/" rel="nofollow noreferrer">Kubernetes Network Model</a> but I cannot see a reliable way to address each a pod from another pod.</p>

<p>I believe I can use a <code>StatefulSet</code>, however, I don't want to lose the <code>ClusterIP</code> assigned to the service which is required by <code>Ingress</code> for load balancing.</p>

<p>Ofcourse you can use statefulset, and ingress doesn't need ClusterIP that assigned to the service, since it uses the endpoints, so 'headless service' is ok.</p>
