<p>I'm quite new to Kubernetes: my question may be more a question of design than of code.
I was wondering: how Kubernetes can handle communication between one pod and replicas of another pods?
My case is simple I have an API pod which pass parameters provided by an UI to a compute unit pods. I will have many replicas of the CU pods depending of my needs, they're waiting for the API to pass them a parameter to work with.
Each CU pod has to work with a different parameter: they're all working the same way but not with the same parameter.
How can I make my API pod aware of the CU pods available to send them the parameter so they can work.
Is it automatic? Is it at least possible or is my cluster poorely designed?</p>

<p>I thought of another way to do this: as soon as my api get a parameter from the ui it will deploy a CU pod with, for example, the parameter given as an environment variable and the CU can work with it.</p>

<p>Thank you in advance for your help!</p>

Romain Martin
<p>In k8s, communication between pods is handled by services. To access any pod within cluster, you need to create ClusterIp service. </p>

<p>So in your case, you need to create ClusterIp service for CU pods so that they can be accessible. once you send request to this service from API pods, it will be sent to any CU pods(Auto load balancing will happen here) which you can not predict or control.</p>

<p>Also to send request from api pods, will get CU ClusterIp service name,port,host details available within API pod as env variable(provided you have created CU service before creating API pods). You can also setup DNS server to access service by their name from pods.</p>
