Kubernetes service with true round-robin

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.24
Cloud being used: (put bare-metal if not on a public cloud)
Installation method:
Host OS:
CNI and version:
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

I have a requirement to use round-robin for a service.
I have a rest api served by 4 pods. This service is using kafka topic that has only 4 partitions. I can only have 4 pods and each pod is assign to a partition (using consumer group).
The rest api have many consumers (more than 4). Unfortunately, with this setup, it seem that the service doesn’t use round-robin to distribute the calls to the service. It always go to the first pod until a certain load (it seems that the distribution to be 50% on the first pod, 30% on second… till 0% to the 4th pod). The problem for us is that messages in kafka are distributed to all partitions (round-robin, I think) and causing some of messages from some partitions are not delivered to the service consumer.
Is there a way to force the service to use round-robin to distribute load to the pods?

1 Like