<p>Have a couple of question on headless services:</p>

<ol>
<li>Is it required to use a headless service for statefulsets? Can I use the normal service.yml for the stateful sets also? </li>
<li>Is it required to use a service &amp; then a headless service? Can I just use headless service instead?</li>
<li>Can I not use the pods to attach to the service instead of headless service?</li>
</ol>

Sandy
<ol>
<li>You don't have to use a Headless Service technically, but it often makes sense to use one if you want to take advantage of the sticky identity of each Pod in a StatefulSet (i.e. address a specific Pod by name rather than any of the Pods at random as it's the case with a normal Service).</li>
<li>Not sure how you mean this. You create a Headless Service by defining a ClusterIP Service and setting the <code>clusterIP</code> field to <code>None</code>.</li>
<li>You can use the Pod names directly too with some tools (e.g. <code>kubectl port-forward</code>), but the Headless Service creates DNS names for all the Pods so you can address them in a more general way.</li>
</ol>
<p><strong>References:</strong></p>
<ul>
<li><a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/</a></li>
<li><a href="https://kubernetes.io/docs/concepts/services-networking/service/#headless-services" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/#headless-services</a></li>
</ul>
