How to Use an Existing AWS NLB with EKS?

0
17
Asked By CuriousCat42 On

I'm working on a project with Terraform that's been great for setting up an Internal ALB, listeners, and target groups. With that setup, I can leverage Kubernetes perfectly using the right annotations in my Ingress and Service configurations. However, I'm now trying to switch this workflow to use an NLB instead and I'm hitting a roadblock. I believe that in my Service file I need to include the line `loadBalancerClass: eks.amazonaws.com/nlb`.

I've added the necessary annotations, but I'm getting a conflicting message when checking my service events. The error states: `DuplicateLoadBalancerName: A load balancer with the same name...but with different settings`. When I leave out the existing NLB parameters, Kubernetes automatically creates one and everything seems to run smoothly with the Service and TargetGroupBinding. I've tried to match all settings to resolve the error but haven't succeeded. Can anyone share their experiences or solutions for this issue? I've managed to see the pods register in the AWS console, but they fail despite having matching health checks, settings, and annotations. I've been looking at the documentation [here](https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/service/nlb/).

3 Answers

Answered By TechieTurtle99 On

You definitely need the AWS Load Balancer Controller installed. Make sure you're using a TargetGroupBinding to connect your service to the right target group in the load balancer. I found a helpful example [here](https://www.reddit.com/r/aws/comments/l03ld5/eks_using_existing_alb_with_aws_load_balancer/). It's totally doable, I've managed it quite a few times for non-HTTP services. Using EKS with an existing or legacy NLB that was set up outside of EKS is definitely fine!

CodeWhisperer77 -

It sounds like you might be trying to recreate the NLB rather than just using the existing one, which isn’t what you want to do.

Answered By ScribbleMaster22 On

Just to clarify, if you're spinning up both the ALB and NLB, make sure your configurations are distinct enough so there’s no overlap that could cause conflicts!

Answered By CloudGuru56 On

Changing from an ALB to an NLB directly is tricky and not always possible. But since you're trying to recreate it, just make sure you have both running separately for comparison. That way you're not actually trying to change one to the other but can see how they both function.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.