Kubernetes (AKS) - how to load balance both TCP and UDP ports for same IP address

1.8k Views Asked by At

We want to run a Wowza streaming engine among other containers in our Kubernetes cluster on Azure Kubernetes Service (AKS). Wowza uses various ports, some with TCP, some with UDP protocol.

We need to expose these ports to the outside world. We can't seem to find a way to set up a load balancer that can forward both TCP and UDP ports.

A LoadBalancer service does not support mixed protocols until an upcoming version of K8s, and it will be even longer until this version is available in AKS: link

We have tried using nginx-ingress, but it has the same limitation due to the underlying K8s limitation: see comment from author here

It would seem like citrix-ingress allows this according to its documentation, but we have a lot of problems making it work at all...

Is there any way to do this that we may have missed? Want to make sure we are not missing something obvious.

2

There are 2 best solutions below

2
coderanger On

You can run your pods with hostNetwork mode and then manually set up a load balancer on top of that or similar. This is not recommended both for security and automation reasons.

2
Wytrzymały Wiktor On

This is a community wiki answer posted for better visibility. Feel free to edit it when the final solution would be available (k8s v1.20 on AKS).

There is an open enhancement: Support of mixed protocols in Services with type=LoadBalancer #1435 which when implemented will enable the creation of a LoadBalancer Service that has different port definitions with different protocols. The stable release is planned for k8s v1.20.

Unfortunately, it is not possible to use both TCP and UDP ports with LoadBalancer Service currently. It would be however when the above solution is in place.