Load balancing graphic

Using NGINX Ingress controller with MetalLB

This document describes getting the NGINX Ingress Controller (the community version rather than the one from NGINX Inc) to work easily with MetalLB.

For the purposes of this guide, it’s assumed that MetalLB is set up. In the example, we’ll assume it’s using an IP range of 192.168.10.x

Firstly, we’ll download the manifest so we can make a change:

curl -o ingress-nginx.yaml https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.43.0/deploy/static/provider/baremetal/deploy.yaml

Once downloaded, we need to edit the file:

nano ingress-nginx.yaml

We now need to find the service that handles the ingress so press control+W and search for:

name: ingress-nginx-controller

Next, replace the line type: NodePort with the following:

  type: LoadBalancer

You can use any IP within the MetalLB range but it’s recommended you specify one to prevent it somehow changing in the future.

Another change you can make is update the deployment so it’s a daemon set rather than a standard deployment. To do this, replace the line:

kind: Deployment


kind: DaemonSet

When you’re finished, save the document using control+s and then quit using control+x

Finally, we’ll install everying by running the following command:

kubectl apply -f ingress-nginx.yaml

The ingress controller, once an ingress is configured, will be accessible on http(s)://

Company Reviews

Leave a Reply