I'm working on an AWS project that involves setting up AWS EKS with my MongoDB running on an EC2 instance. I'm building a simple TODO app in Golang, and I've successfully pushed my Docker image to AWS ECR. However, I'm struggling to connect everything together. I initially tried deploying an AWS NLB via Terraform, but I wasn't able to get any healthy targets in my target group using the EKS node instance IPs. Although I was able to deploy a new Nginx load balancer using a manifest and kubectl, my app was exposed, but I still couldn't connect to the MongoDB database. Everything is within one VPC. Can anyone provide some guidance?
1 Answer
You need to install the AWS Load Balancer Controller first. It’s essential for properly setting up your LoadBalancer service in EKS. After that's done, create a service of type 'LoadBalancer' and EKS will take care of provisioning the NLB for you. Don’t forget to check the annotations in the documentation to customize your setup!
I had similar issues but ended up getting it to work with the commands you mentioned, and my targets started showing healthy. My main problem was connecting to the database afterward.