Expose Services to CNI/VNet only, instead of globally via Azure Load Balancer
Is this a request for help?:
request for help.
Is this an ISSUE or FEATURE REQUEST? (choose one):
ISSUE
What version of acs-engine?:
v0.9.4
Orchestrator and version (e.g. Kubernetes, DC/OS, Swarm)
Kubernetes
What happened:
First, thank you very much for your good work.
I searched the issue list already, but could not find sth that covers my set up. So here is my question.
I set up a kubernetes cluster inside a custom vnet using acs-engine as shown in https://github.com/Azure/acs-engine/tree/master/examples/vnet and everything works fine. In this project, we do have a proprietary proxy appliance (not really nginx feature wise, but for now lets assume it behaves like nginx) which is deployed to a VM in the before mentioned vnet. What is the best way to configure services running in the k8s cluster as backends for this proxy and at the same time keep communication inside the vnet?
Right now, we configure the service's type to LoadBalancer. This will create a public Azure Load Balancer which we use as the backend in the proxy. We add a nsg to protect that public endpoint. It works, but is not ideal. Downside here definitely is the long detour from our proxy to the azure load balancer and back into the k8s cluster.
Alternatively, we could set the service type to NodePort and configure all agent ips (which are in the same vnet) as downstream servers in the proxy. When scaling the cluster up or down, the list has to be updated, unless we write some code that retrieves the latest list of agent ips from the k8s master. Right now, we would like to avoid that, but would go that route if it is the best.
Ideally, we would like to be able to configure the k8s service's cluster ip as the backend, but the 10.0.0.0/8 overlay network is not reachable from the outside (apart from overlapping our vnet anyways). Is there a way to change the subnet used to create the cluster ips and then set up vnet peering with the other vnet? Or is there a way to add a nic into that overlay network and add it to our proxy to get access into that network?
Do you have further ideas to set this up? Anything that points me into the right direction is very much appreciated. Also glad to hear best practices for this kind of setup.
Thank you very much in advance.
This might be what you are looking for: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
you will just need to add an annotation on the LoadBalancer service.
Awesome, exactly what I was looking for. Works as expected. Thank you very much.