How can I have one Kubernetes LoadBalancer balance to multiple services? How can I have one Kubernetes LoadBalancer balance to multiple services? kubernetes kubernetes

How can I have one Kubernetes LoadBalancer balance to multiple services?


The Ingress resource, which was added in version 1.1.0, was designed specifically for this use case. It allows you to put multiple services behind a single IP address, routing to them based on HTTP path. Check out the user guide on it for more details, but feel free to ask if you have more questions about it!

edit: For a non-HTTP(S) service, you can have to find a way to make sure all necessary ports get load balanced by the ELB and then properly routed by Kubernetes. On GCE, you could manually create the load balancer with the ports you need, and then put the load balancer's IP in the externalIPs field for each service. My memory's a little fuzzy, but I don't believe that'll work with an ELB due to its packet rewriting. You might instead want to create each service as a NodePort service, then configure your ELB to forward the packets from the correct external port to the node port for each service.


You could also simply use nginx as a proxy for your minecraft server, and forward traffic from ingress port 25565 to the minecraft server. That way all traffic goes through one Service