0
votes

I am testing stateful sets with replicas, is there a way to force a service on each replica? For example, if I refer to the following note:

https://itnext.io/introduction-to-stateful-services-kubernetes-6018fd99338d

It shows headless service is created on top of pods. I do not have a way to force the connection to the first pod or the pod-0 or the 2nd pod i.e. pod-1.

1

1 Answers

1
votes

You can access the pods directly, or you can create headless services as you write. This headless service is not created automatically, it is up to you to create it.

you are responsible for creating the Headless Service responsible for the network identity of the pods.

From StatefulSet - Stable Network Identity

Also see StatefulSet Basics - Headless Services on how to create headless services, by setting clusterIP: "None"