Home > Software engineering >  Exposing Service from a BareMetal(Kubeadm) Kubernetes Cluster to outside world
Exposing Service from a BareMetal(Kubeadm) Kubernetes Cluster to outside world

Time:01-26

Exposing Service from a BareMetal(Kubeadm) Build Kubernetes Cluster to the outside world. I am trying to access my Nginx as a service outside of the cluster to get NGINX output in the web browser.

For that, I have created a deployment and service for NGINX as shown below, enter image description here

As per my search, found that we have below to expose to outside world

  • MetalLb
  • Ingress NGINX
  • Some HELM resources

I would like to know all these 3 or any more approaches in such way it help me to learn new things.

GOAL

  • Exposing Service from a BareMetal(Kubeadm) Built Kubernetes Cluster to the outside world.
  • How Can I make my service has its own public IP to access from the outside cluster?

CodePudding user response:

You need to set up MetalLB to get an external IP address for the LoadBalancer type services. It will give a local network IP address to the service.

Then you can do port mapping (configuration in the router) of incoming traffic of port 80 and port 443 to your external service IP address.

I have done a similar setup you can check it here in detail: https://developerdiary.me/lets-build-low-budget-aws-at-home/

CodePudding user response:

You need to deploy an ingress controller in your cluster so that it gives you an entrypoint where your applications can be accessed. Traditionally, in a cloud native environment it would automatically provision a LoadBalancer for you that will read the rules you define inside your Ingress object and route your request to the appropriate service.

One of the most commonly used ingress controller is the Nginx Ingress Controller. There are multiple ways you can use to deploy it (mainfests, helm, operators). In case of bare metal clusters, there are multiple considerations which you can read here.

MetalLB is still in beta stage so its your choice if you want to use. If you don't have a hard requirement to expose the ingress controller as a LoadBalancer, you can expose it as a NodePort Service that will accessible across all your nodes in the cluster. You can then map that NodePort Service in your DNS so that the ingress rules are evaluated.

  • Related