Exposing a Kubernetes service on a bare-metal cluster over the external network architecture

5/4/2020

I’ve build a bare-metal multi-node, multi-server Kubernetes cluster and this is my first experience.

  • The cluster is built across many servers; each server contains a set of nodes.

  • The connection is done over public ip addresses on the LAN.

  • I run deployments on the cluster and it’s working.

But I want to expose a service over the external network.

If I were using Minikube, I would use a LoadBalancer to expose the service externally.

Troubleshooting:

  1. I am thinking about using an ingress-controller or a NodePort Service as a solution to access the pods-network.
  2. I tried to expose a NodePort service, but I didn't get an external ip.

I am asking if someone could help me set a running hello-world, but choosing the right architecture for this bare-metal cluster.

Thank you.

-- Zouari.M
kubernetes
kubernetes-ingress
networking

1 Answer

5/4/2020

I suggest using MetalLB which is a LoadBalancer for bare metal clusters.

Also you could combine this with a bare metal Ingress controller like Nginx.

Regarding Nginx you can find more details here.

I have successfully used this combination as well as with a wildcard domain (e.g *.mydomain) pointing to one of the cluster IPs. This allows to define as many combinations as you like to point to different services deployed on the cluster (e.g. service1.mydomain, service2.mydomain, etc.).

What I would also suggest is installing Helm as this would greatly help you with deployments. You can find a lot of charts for most of the widely spread services and it gives you the ability to configure them easily. Also it is quite a good practice to create charts for your future services as well for good maintenance and customization.

-- Slacky
Source: StackOverflow