Communicating to all Kubernetes pods behind a service

4/29/2019

What is the best way to communicate information to all of the pods that are abstracted behind a service? For simplicity, let's say there is some entity that produces information at random times for the pods to consume and all of the pods should consume the information at the earliest.

I was thinking of doing a rest POST to the service whenever the information is produced, such that the data is received by all pods behind this service. However, k8s service does not guarantee that it's communicated to all pods.

Alternatively, I could think of storing the info from producer and for each pod to pick it up from storage. But is there any other better approach for this? Thanks!

-- not_again_stackoverflow
kubectl
kubernetes
kubernetes-ingress
kubernetes-pod

1 Answer

4/30/2019

Service is a simple round-robin iptables rule. It delivers one packet exactly to one pod. It is not designed for fanout delivery. If you want one-to-many delivery then you should use message broker like Kafka or RabbitMQ.

-- Vasily Angapov
Source: StackOverflow