jcmoraisjr / haproxy-ingress

HAProxy Ingress
https://haproxy-ingress.github.io
Apache License 2.0
1.04k stars 269 forks source link

HAProxy ingress controller is creating ELBs, which are deprecated in AWS and will be removed after August 2022 #920

Open dbarvitsky opened 2 years ago

dbarvitsky commented 2 years ago

Description of the problem

I was looking into a way of controlling request affinity in Kubernetes and followed the instructions in the docs. Our Kubernetes clusters are running in AWS, specifically EKS. I noticed that running in LoadBalancer mode creates an AWS load balancer of the ELB type, which is deprecated per AWS and will no longer be able to run after August 2022. I looked through help and configuration options and didn't find an apparent way to force HAProxy to use NLBs or ALBs instead.

As a workaround, it is possible to use node ports, but that doesn't work for general case in microservice environment (requires coordination between teams and port assignments).

Expected behavior

NLB or ALB load balancer should be created when running in the LoadBalancer mode.

Steps to reproduce the problem

  1. Create a VPC with EKS cluster
  2. Follow the demo instructions
  3. Observe: the type of the load balancer created in AWS is ELB.

Environment information

HAProxy Ingress version: v0.13.6

dbarvitsky commented 2 years ago

Found a way to do it with NLB (inspired by #713).

I ended up adding annotations to the ingress service:

# haproxy-ingress-values.yaml
controller:
  hostNetwork: true
  ...
  service:
    type: LoadBalancer
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-type: nlb
      # This is irrelevant, but might be useful too.
      service.beta.kubernetes.io/aws-load-balancer-internal: "true"

And then install as usual:

$> helm3 install --namespace whatever  haproxy-ingress haproxy-ingress/haproxy-ingress --version 0.13.6 -f haproxy-ingress-values.yaml

Relevant documentation is available in sigs. Admittedly, this can be considered common knowledge and hence lack of my expertise trying to setting up HAProxy ingress. I think a noob like me could benefit from a note in getting started to tripping over it.

eifelmicha commented 2 years ago

@dbarvitsky According to the article this is only relevant for Class Load Balancer not running inside a VPC. Notice also the checkbox at the top of the page.