TransWikia.com

Create service per pod in statefulset

DevOps Asked by flowerProgrammer on August 22, 2021

I have a statefulset app which can have any number of replicas. The pods produced should be able to communicate to external comptures. Those pods must act statefully when clients communicate with them.
I tried to create headless service and nodeport services, but it still has only one service to communicate with and also couldn’t make it to communicate externally.
How can I make it allocate external ip and port per each port?

One Answer

Just to clarify if I got you right.

Do you want to have a separate service for every pod/replica in your statefulSet?

If so - this is not how K8s sees services being used. The service is used for grouping and load balancing purposes.

In your case, if you want to have 1-on-1 connection between an external client and a pod, I suggest deploying your statefulSet a number of times with replicas=1 and exposing a service (as NodePort/LB) every time.

Answered by Alexey S. on August 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP