Multiple Services in a Single Statefulset

hi,

  • Does anyone have idea on how to use, multiple services in a single statefulset file.

  • How can we assign one service to one pod. ( for example if we have 3 services and 3 pods, we have to assign one service to one pod. like that all the three pods should have a different service attached to it)

1 Like

What is the problem using labels for that?

We did this by creating an initContainer that uses a pod’s hostname and adds it as a label to that pod. We then have N services that have a label selector for that. Since the statefulset hostnames are computable it worked OK.

We used this as a work around for DNS clients caching the IP for Zookeeper