0

I am designing a chat like application where I am running 2 pods of same service for scalability.

Now assume user 1 connected to pod1 through web socket connection and user 2 connected to pod2. User1 want to interact with user2 but both got connected to different pods. Now how to establish inter pod communication on K8S. Are there any options available to connect using its pod name or any other good mechanism available for inter pod communication to exchange messages between different pods of same service.

1 Answers1

4

Now how to establish inter pod communication on K8S.

You can do this using StatefulSet - it provides a "stable network identiy".

But the easiest way to handle this for you is to use some form of "communication hub" using a Pub-Sub protocol. An example is to use Redis, and both your pods can publish messages to Redis and also subscribe on messages.

Jonas
  • 121,568
  • 97
  • 310
  • 388