Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 348
Łukasz Baran Avatar asked Oct 15 '25 11:10

Łukasz Baran


1 Answers

In Azure container service, Azure will use Load Balancer to expose k8s services, like this:

root@k8s-master-E27AE453-0:~# kubectl get svc
NAME         CLUSTER-IP    EXTERNAL-IP     PORT(S)          AGE
jasonnginx   10.0.41.194   52.226.33.200   8080:32011/TCP   4m
kubernetes   10.0.0.1      <none>          443/TCP          11m
mynginx      10.0.144.49   40.71.230.60    80:32366/TCP     5m
yournginx    10.0.147.28   40.71.226.23    80:32289/TCP     4m
root@k8s-master-E27AE453-0:~# 

Via Azure portal, check Azure load balancer frontend IP configuration(different IP address):

enter image description here

ACS will create Load Balancer rules and add rontend IP address automatically.

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

ACS expose k8s services through that Azure Load Balancer, do you mean you want to expose k8s services with a single Public IP address?

If you want to expose k8s services with a single public IP address, as Radek said, maybe you should use Nginx Ingress Controller.

The Ingress Controller works like this:

enter image description here

like image 132
Jason Ye Avatar answered Oct 18 '25 00:10

Jason Ye



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!