11

What is the difference between Nginx ingress controller and HAProxy load balancer in kubernetes?

Saeid
  • 4,147
  • 7
  • 27
  • 43
yasin lachini
  • 5,188
  • 6
  • 33
  • 56

1 Answers1

13

First, let's have a quick overview of what an Ingress Controller is in Kubernetes.

  • Ingress Controller: controller that responds to changes in Ingress rules and changes its internal configuration accordingly

So, both the HAProxy ingress controller and the Nginx ingress controller will listen for these Ingress configuration changes and configure their own running server instances to route traffic as specified in the targeted Ingress rules. The main differences come down to the specific differences in use cases between Nginx and HAProxy themselves.

For the most part, Nginx comes with more batteries included for serving web content, such as configurable content caching, serving local files, etc. HAProxy is more stripped down, and better equipped for high-performance network workloads.

The available configurations for HAProxy can be found here and the available configuration methods for Nginx ingress controller are here.

I would add that Haproxy is capable of doing TLS / SSL offloading (SSL termination or TLS termination) for non-http protocols such as mqtt, redis and ftp type workloads.

The differences go deeper than this, however, and these issues go into more detail on them:

  1. https://serverfault.com/questions/229945/what-are-the-differences-between-haproxy-and-ngnix-in-reverse-proxy-mode
  2. HAProxy vs. Nginx
Christian Matthew
  • 4,014
  • 4
  • 33
  • 43
Monkeyanator
  • 1,346
  • 2
  • 14
  • 29
  • my question is what is diffrent between ingress and load balancer.forexample what is diffrent between ingress controller and loadbalancer – yasin lachini Mar 14 '19 at 20:32
  • The difference is that a LoadBalancer will create a cloud-specific LB (so, a GCLB in GCP, an ELB on AWS, etc etc) that exposes a *single* service to the outside world. An ingress controller listens for the creation of Ingress objects, and hacks its internal configuration based on those changes (e.g. Nginx controller sees new Ingress that should route traffic from www.hello.com to service hello, and will configure the Nginx server running in the Deployment to do so). – Monkeyanator Mar 14 '19 at 20:35
  • Then, you can create a LoadBalancer that exposes the nginx-ingress-controller or haproxy-ingress-controller Deployment to the outside world. Does that make more sense? – Monkeyanator Mar 14 '19 at 20:36
  • i do not want to use cloud load balancer.what should i do? thanks – yasin lachini Mar 14 '19 at 20:46
  • There are a few options for that (using MetalLB, NodePort service) that are outlined here: https://kubernetes.github.io/ingress-nginx/deploy/baremetal/ – Monkeyanator Mar 14 '19 at 21:05
  • @yasinlachini there is a good blog to help you https://www.haproxy.com/blog/dissecting-the-haproxy-kubernetes-ingress-controller/ – Seyed Morteza Hosseini May 06 '20 at 08:53