16

From what I understand,

Metallb is a load balancer that assigns IP address to a service, which can be exposed to the outside world.

Nginx Ingress is just like normal nginx, but it resides in kubernetes and provides routing to different routes.

My question is, why do I need Metallb if I have Nginx Ingress? Because nginx ingress will expose port 80/443 to public and I can just use that to route to services I need.

Thank you.

1
  • Welcome to Super User! You can probably test this yourself. Run Nginx Ingress and if you then don't need Metallb, then you don't need it. Did someone say to you that you need to have Metallb? Commented Feb 4, 2020 at 20:00

1 Answer 1

18

You will need both, as they solve separate problems:

  • MetalLB receives requests from the outside of the cluster, and balances them across the load balancer(s) in the cluster

  • Nginx receives requests from outside the cluster and balances them across the nodes.

See https://kubernetes.github.io/ingress-nginx/deploy/baremetal/#a-pure-software-solution-metallb for details.

Without MetalLB, nginx ingress service in bare metal stays in pending state because it has no IP assigned to it. MetalLB does the job of assigning nginx an external IP.

Without Nginx, you will have to perform TLS termination on every client, something that is generally not advisable.

Another way of looking at it:

  • nginx ingress handles the type Ingress
  • metallb handles the type LoadBalancer

The confusion likely stems from the fact while the operations above are fundamentally different, they are often done by a "load balancer".

Note that the same applies in the cloud: you need to deploy an ingress to handle TLS termination and others, and the provider automatically creates a load balancer on their infrastructure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .