Kubernetes Service - which type to use NodePort or LoadBalancer?

1/28/2021

I've read a lot about Services (NodePort and LB) https://kubernetes.io/docs/concepts/services-networking/service/ but I still have dilemma what to use. I have AKS cluster in Azure. In the same Virtual Network I have VM outside the cluster that should target specific app, container pod on port 9000. App in container pod is being run on Port 9000. I have two options:

  • expose that service as NodePort on some port in range from 30000-32767 let's say 30001 but in that case I must change all my outside VMs and apps that they should not target and connect to port 9000 which is regular port for this application but this new Port 30001 which for this app really sounds strange
  • expose that service in Azure as Load Balancer (I can do that because it is Cloud Platform but I do not like that in that case it will expose my service via Public Address. This is very bad, I do not want for this to be accessible from the internet on public IP address.

I am really confused what should I choose. I will appreciate advices.

Thank you

-- AndreyS
azure-aks
containers
docker
kubernetes
kubernetes-pod

1 Answer

1/28/2021

There is a good option to create Internal Load Balancer which is accessible only within Virtual Network.

-- Vasili Angapov
Source: StackOverflow