<p>I have created a server named <a href="https://github.com/CyBear-Jinni/cbj_remote-pipes" rel="nofollow noreferrer">Remote Pipes</a> that get clients connections with streams and transfer data between them.</p>
<p>On one side there is a computer Hub and on the other side there are a number of App clients.</p>
<p>The Hub client connects to the Remote Pipes and a two-way stream remains open.</p>
<p>All the Apps clients connect to the Remote Pipes and a <a href="https://github.com/CyBear-Jinni/cbj_remote-pipes/blob/main/lib/domain/hube_server/smart_server_u.dart" rel="nofollow noreferrer">two-way stream remains open</a>.</p>
<p>Whenever the Hub wants to send data for the Apps clients he sends it to the Remote Pipes, and the Remote pipes send each connected App client the data through (already opened) opened stream.</p>
<p>Whenever one of the app clients wants to send data for the Hub he sends it to the Remote Pipes which combines all streams from the Apps and sends them through a single (already opened) stream to the Hub.</p>
<p><a href="https://i.stack.imgur.com/fbpjym.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fbpjym.jpg" alt="enter image description here" /></a></p>
<p>Remote Pipes do not store data nor use local storage nor use local DB and each instance is intended for one family.</p>
<p>So I want to create a Kubernetes pod with Remote Pipes for each family and all family members need to connect to the same pod.</p>
<p>No need for a persistent pod, if one pod gets deleted (in case there are no connections) a new one is ok as long as all the family members Apps clients and the Hub client connect to the same pod.</p>
<p><strong>The Question:</strong></p>
<p>Searching for a way to make <strong>multiple users connect to the same kubernetes pod</strong> (like game/zoom lobbies?) and I am not sure what is the best option.</p>
<p>The routing must be created <strong>dynamically and be scalable</strong> so routing based on ports and Name-based routing are not a good fit.</p>
<p>Here are a number of terms that I found that may be related</p>
<ol>
<li>Stateful application</li>
<li>Headless services</li>
<li>Auto-labeling</li>
<li><a href="https://github.com/linode/linode-cloud-controller-manager" rel="nofollow noreferrer">kube-proxy</a></li>
<li>Host based routing</li>
<li>Path based routing</li>
<li>Header based routing</li>
<li>Software/Application Load balancer</li>
</ol>
<p>I am using Linode so using Linode NodeBalancers is preferable if load balancer is required.</p>

<p><strong>Kafka</strong> might help if we put it in between however not sure what you are streaming if it's payload data that would be good</p>
<p><a href="https://i.stack.imgur.com/wqmBY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wqmBY.png" alt="enter image description here" /></a></p>
<p>as you have mentioned</p>
<blockquote>
<p>No need for a persistent pod</p>
</blockquote>
<p>You can use the <strong>Kind</strong> : <strong>Deployment</strong> for application while Kafka will be stateful sets.</p>
<p>If you are using the <strong>WebRTC</strong> there won't be any issue.
<a href="https://i.stack.imgur.com/NPBlC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NPBlC.png" alt="enter image description here" /></a></p>
<p>You should checkout : <a href="https://cloud.google.com/architecture/orchestrating-gpu-accelerated-streaming-apps-using-webrtc" rel="nofollow noreferrer">https://cloud.google.com/architecture/orchestrating-gpu-accelerated-streaming-apps-using-webrtc</a></p>
