<p>I'm using the <a href="https://github.com/kubernetes-client/csharp" rel="nofollow noreferrer">C# client API</a> and I'm trying to:</p>
<ol>
<li>Get all pods associated with a given StatefulSet</li>
<li>Get the cluster IP address of each pod</li>
</ol>
<p>I am aware of <code>Kubernetes.CoreV1.ListNamespacedPodAsync</code> and <code>Kubernetes.AppsV1.ListNamespacedStatefulSetAsync</code>. The part that I'm missing is how to</p>
<ol>
<li>Know whether a given pod is associated with the StatefulSet</li>
<li>Discover a pod's IP address</li>
</ol>

fr0
<p>A feature of Kubernetes StatefulSet is <em>Stable Network Identity</em>. This requires that additional <em>headless Services</em> are created, in addition to the <code>StatefulSet</code> resource.</p>
<p>When this is done, you would typically access these instances by their <strong>hostname</strong> instead of using IP address directly. See <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-network-id" rel="nofollow noreferrer">Stable Network ID</a> for documentation about this.</p>
<p>E.g. after <em>headless Services</em> are created you could access 3 instances on these <strong>hostnames</strong></p>
<ul>
<li>my-app-0</li>
<li>my-app-1</li>
<li>my-app-2</li>
</ul>
<p>(when accessed from within the same namespace)</p>
