Exposing service to the internet from a bare metal kubernetes cluster

7/13/2020

I'm running a Kuberenets with 1 master and 2 slaves. I have a deployment and service pointing to it with type of NodePort. I'm able to access the service from the workers themselves, but I want to expose the service in a way it will load balance between the workers and without specifying a port. I'm running on bare-metal, so I can't expose the service as a LoadBalancer and use google/amazon load balancing. How can I do that?

-- Yaakov Shami
kubernetes

1 Answer

7/13/2020

You can use metalLB which hooks into your Kubernetes cluster, and provides a network load-balancer implementation. In short, it allows you to create Kubernetes services of type LoadBalancer in clusters that don’t run on a cloud provider, and thus cannot simply hook into paid products to provide load-balancers.

It has two features that work together to provide this service: address allocation, and external announcemen

MetalLB requires the following to function:

  1. A Kubernetes cluster, running Kubernetes 1.13.0 or later, that does not already have network load-balancing functionality.
  2. A cluster network configuration that can coexist with MetalLB.
  3. Some IPv4 addresses for MetalLB to hand out.
  4. Depending on the operating mode, you may need one or more routers capable of speaking BGP.
-- Arghya Sadhu
Source: StackOverflow