3
votes

I am new to Kubernetes and AWS and exploring different AWS technologies for a project. One thing I am doing as part of that is to see how we can have routes in API Gateway connect to an EKS cluster (in a VPC).

This is what I have working:

  • An EKS Cluster
  • In the EKS Cluster I have nginx ingress-controller running
  • I have an EC2 inside the VPC and verified that I can reach a service running in the cluster through EC2 by using the ingress-controller url

This is what I am trying:

  • I tried to create an API Gateway route to access the same service using the ingress-controller url -> To achieve that, I am trying the steps here (because my cluster is in a VPC): https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-nlb-for-vpclink-using-console.html
  • One thing that is not clear to me is that, how do I specify the ingress-controller url as a target for the NLB? The only targets that I can specify are EC2 instances, but I want to direct the traffic through the ingress-controller (which is a service of type loadbalancer in K8s).

If I am doing this wrong way, please advice the right way of exposing EKS cluster in API Gateway through the nginx ingress controller. Thanks!

1
What are you trying to achieve by adding API Gateway? It's mostly used with other serverless services. I think you should ask yourself what benefit you expect from doing this? Because it certainly adds complexity (and expense if your project is actually used.)Gergely Szabo

1 Answers

2
votes

I have found the problem. When using nginx-ingress-controller, I just had to specify the annotation that it is of type "nlb"

service.beta.kubernetes.io/aws-load-balancer-type: nlb

Once I deploy the ingress controller with this annotation, it automatically creates an nlb in aws and sets the target according to the ingress defined! I was creating a new nlb myself and then trying to point to the ingress-controller which is not needed (nor the right way).