简体   繁体   中英

How to communicate between pods of the same service on the same k8s cluster using k8s-java-client?

I have a kubernetes cluster that has many services on it. How can I make one pod publish a message, and receive it from another siblings pods (pods of the same service), using kubernetes-java-client.

Until now, I didn't find a way to do the job done.

Example: 1 Service -> 4 pod (4/4 replicaSet)

Invoke Api in the service, load balance takes the request to 1 Pod, so other pods need to do a reaction because a specific Api in another pod has been activated.

So, the pod publish an event, and other sibling pods consumes the event, an do the reaction. Or the pod communicates directly with its siblings to tell them to do the reaction.

Is this possible, and what is the right way to a similar scenario?

除了使用Kubernetes API(通常是通过端点API)发现对等Pod之外,它没有提供任何特别针对实际通信的内容,这取决于您的代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM