Search code examples
azurekubernetesazure-load-balancerazure-aks

How to expose multiple kubernetes services trough single azure load balancer?


I want to expose multiple services trough single load balancer. Each service points to exactly one pod.

So far I tried to:

kubectl expose <podName> --port=7000 

And in Azure portal to manually set either load balancing rules or Inbound Nat rules, pointing to exposed pod. So far I can connect to pod using external IP and specified port.


Solution

  • Thanks guys. I think I have found viable solution to my problem. I should have been more specific about what I'm going to do.

    I want to host game server over UDP. So any kubernetes ingress controller is not really an option, since they rarely support UDP routing. I also don't need to host multitude of services on single machine 1-4 of pods per single node is probably the maximum.

    I have found about using :

    hostNetwork: true 
    

    in yaml config and it actually works pretty well for this scenario. I get IP directly from host node. I can then select matching node within load balancer and create NAT or load balancing rule