Fore few days I've been playing with Kubernetes cluster on Azure Container Service, with goal to host Unreal game servers on it.
After days of experiments and few questions on SO I got to the point where I can host few servers on single node and connect to them with clients.
In my latest setup I deployed PODs directly with hostNetwork: true. Added LoadBalancer with public IP and manually mapped ports from agent node where pods are deployed to NAT load balancer.
While works I'm not entirely convinced it is good solution. While it can be automated I'm not sure it will be scalable under load.
I need to wait until pod is created. I can assume what port is needed, because unreal aromatically open on 7777 port and then increment by one until it find one.
Once pod is created I need to add NAT port forwarding to load balancer (but I can't do it until I know on which Node pod is located).
Adding new NAT rules to load balancer takes time. Quite a bit of time, from what I have seen so far.
I'm using external load balancer to route traffic at particular PODs. It probabaly would be better to do it from within Kubernetes.
There few things that must be meet:
Client connect to server trough UDP.
It would be best keep amount of public IPs to minimum.
What would be best way to directly expose PODs trough UDP to external clients ? Port Forwarding is not that bad option (although is limited in the amount of PODs I can expose trough single public ip, at least I think so). What I'd like to achive is to either connect client directly to server, or route client traffic to particular POD (ie router->service->pod scenario is acceptable, but the less indirection the better).
I have read this: http://www.compoundtheory.com/scaling-dedicated-game-servers-with-kubernetes-part-1-containerising-and-deploying/ And it is nice source on information although I'm not sure if the server is connected trough UDP (which is must have requirement for me). Or how exactly does unity client connect directly to internal POD IP.
I suggest you to take a look on Ingresses controller, I know that the Nginx one support UDP routing.
So, you expose Nginx-ingress with load-balancer IP and you create UDP configmap to route directly on your pods.
You should give it a try.
https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/udp