How to expose a service in kubernetes running on Barematel

11/28/2018

Kubernetes Version: 1.10 Running on Barematel

No. of masters: 3

We are running our multiple microservices inside a Kubernetes cluster. Currently, we are exposing these services outside of the cluster using NodePort. Each microservice has it's own NodePort so we have to maintain a list with the corresponding microservices. Since we are running on Barematel we don't have features like LodeBalancer while exposing a microservice.

Problem: - Since we have multiple masters and workers inside the cluster we have to use a static IP or DNS for any master at a time. If I want to access any service from outside the cluster I have to use as - IP_ADDRESS:NODEPORT or DNS:NODEPORT. At a time I can use the address of any one master. If that master goes gown then I have to change microservices address with other master's address. I don't want to use a static IP or DNS of any master.

What could we a better way to expose these microservices without NodePort? Is there any feature like LoadBalancer over Baremetal? Can INGRESS or Nginx help us?

-- Himanshu_Rajput
kubernetes
kubernetes-ingress
microservices
nginx
nginx-ingress

1 Answer

11/28/2018

There is a LoadBalancer for Baremetal, it's called METALLB. Project is available on GitHub, unfortunately this solution is in alpha state and is more complex.

You can also follow the instructions from NGINX and setup round-robin method for TCP or UDP.

Ingress only supports http(s) over ports 80, 443 only. You can of course setup your own ingress controller but it will be a lot of extra work.

NodePort downside is a limited number of usable ports which is from 30000 to 32767, and if IP of the machine changes your services will be inaccessible.

-- Crou
Source: StackOverflow