Overview

In our quest to build dynamic game servers for a social platform, we are utilizing Mediasoup to facilitate the transport of game and video data via WebRTC and UDP SCTP/SRTP. Each game server is designed to support approximately 50 clients, with each client requiring 2 to 4 UDP ports for effective communication.

Current Infrastructure

We are leveraging Kubernetes for provisioning our game servers, in conjunction with Agones for game server management. Our DevOps strategy can be found in our GitHub repository.

Port Requirements

Given that Mediasoup mandates that each client connection is assigned a unique port, we need to ensure that each server can accommodate around 100 publicly accessible ports to handle the expected client load. This presents a challenge in routing UDP traffic effectively to the appropriate game server.

Challenges with Ingress

Traditional ingress controllers, such as NGINX, are primarily designed for HTTP(S) traffic. Configuring them to manage UDP traffic requires prior knowledge of the game server services, which is impractical since these servers are dynamically created and destroyed based on demand.

Proposed Solutions

We have identified two potential approaches to address this issue:

Option 1: Public IP Assignment

One approach is to assign public IP addresses to each game server within the node group. This would involve allocating specific ports for each client connection, which may require SSL termination for the IP ports in AWS. We are exploring whether we can utilize Elastic Network Interfaces (ENIs) and EKS to dynamically provision IP addresses and ports for each game server, allowing them to be exposed to the internet via a public subnet. For more details, refer to the AWS ENI documentation.

Option 2: Dynamic Subdomain Creation

Alternatively, we could create dynamic subdomains for each game server (e.g., gameserver01.gs.xrengine.io) and allocate ports dynamically for each client (e.g., client 1 using ports 30000-30004). However, this method may be constrained by the available ports in the EKS fleet.

Conclusion

Both approaches have their merits, and we seek guidance on their feasibility and implementation details. Which method would be more effective for our use case? Any insights into the implementation process would be greatly appreciated.