load balance an external service in my kubernetes cluster

7/26/2018

I have a kubernetes cluster installed. I want to use an external database ( out of my cluster ) for one of my microservices but this external db is set as a cluster and does not have it's own load balancer.

is there a way to create an internal loadbalancer service that will allow kubernetes to always direct the microservices to the running instance?

I saw that you can set a service of type loadbalancer,how can I use it? I tried creating it but I saw the loadbalancer service was created with NodePort. can it be used without a NodePort?

many thanks

-- eran meiri
kubernetes
load-balancing

1 Answer

7/26/2018

You cannot, as far as I'm aware, have a Kubernetes service healthcheck an external service and provide loadbalancing to it.

The Service of type=LoadBalancer refers to cloudproviders' LoadBalancers, like ELB for AWS. This automates the process of adding NodePort services to those cloud provider LoadBalancers.

You may be able to get the solution you require using a service mesh like Istio but that's a relatively complex setup.

I would recommend putting something like HAProxy/KeepAliveD of IPVS in front of your database

-- jaxxstorm
Source: StackOverflow