In my AWS EKS, I have installed nginx-ingress with following command:
helm upgrade --install -f controller.yaml
--namespace nginx-ingress
--create-namespace
--version 3.26.0
nginx-ingress ingress-nginx/ingress-nginx
Where controller.yaml
file looks like this:
controller:
ingressClass: nginx-internal
service:
internal:
enabled: true
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
I have few applications, and individual ingresses per application with different virtual hosts and I want all ingress objects point to internal load balancer,
Even if I set ingressClass
in ingresses of applications, It seems they point to Public Load balancer:
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx-internal
So, is there a way to create only single internal load balancer with its ingresses pointing to that load balancer ?
Thanks
4
Answers
Noticed in your
controller.yaml
that you enabledinternal
setup. According to documentation, this setup creates two load balancers, an external and an internal, in case you want to expose some applications to internet and others only inside your vpc in same k8s cluster.If you want just one internal load balancer, try to setup you
controller.yaml
like this:It will provision just one NBL that routes the traffic internally.
Using
service.beta.kubernetes.io/aws-load-balancer-subnets
annotation, you can choose which Availability Zones / Subnets your load balancer will routes traffic to.If you remove
service.beta.kubernetes.io/aws-load-balancer-type
annotation, a Classic Load Balancer will be provisioned instead of Network.I managed to get this working by using the following
controller.yaml
Then you can use the
ingressClassName
as followsIt’s not necessary but I deployed this to a namespace that reflected the internal only ingress
Based on @rmakoto answer, it seems some configs are missing, in order to tell AWS to create an internal NLB. I’ve tried with the following configs, and now it works like expected:
Now to deploy run the following command:
If you only want classic ELBs. This worked for me.