<p>I'm planning to deploy more than 30 apps in 5 namespaces. I will be using existing AWS EKS 1.21 Cluster. All the apps will be requiring external access because it's being used by clients. I don't want to use multiple load balancers to ease the management and also avoiding extra cost on AWS side (because ELB is charged based on hourly usage too.)</p>
<p>What I'm trying to do it basically ;</p>
<pre><code> apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
   name: random-ingress
 spec:
   rules:
   - host: randomhost-in-namespace1.com
     http:
       paths:
       - path: /
         backend:
           serviceName: randomhost-in-namespace1 (in first namespace)
           servicePort: 80
   - host: randomhost-in-namespace2.com
     http:
       paths:
       - path: /
         backend:
           serviceName: randomhost-in-namespace2 (in second namespace)
           servicePort: 80
   - host: randomhost-in-namespace3.com
     http:
       paths:
       - path: /
         backend:
           serviceName: randomhost-in-namespace3 (in third namespace)
           servicePort: 80
</code></pre>
<p>Something like this.</p>
<p>Is it possible to cover all these apps in all these namespaces with a single ingress load balancer? I didn't find any clear information about this.</p>
<p>Any help will be highly appreciated.
Thank you.</p>

Oguzhan Aygun
<p>using the <a href="https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html" rel="nofollow noreferrer">AWS LB Controller</a> and not Nginx LB, you can have <strong>1x ALB</strong>, re-used by each namespace.</p>
<p>define Ingress.yaml file per namespace and annotate them with the same <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/#ingressgroup" rel="nofollow noreferrer">alb-group-name</a>.</p>
<blockquote>
<p>If group.name specified, all Ingresses with this IngressClass will
belong to the same IngressGroup specified and result in a single ALB.</p>
</blockquote>
<p>the AWS LB Controller will then create 1x ALB, it desired rules, listeners to TG's and register the right EC2 nodes etc.</p>
<p>this can be something like this:</p>
<p><strong>Ingress-namespace1.yaml</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: random-ingress
  namespace: namespace1
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: my-group
    alb.ingress.kubernetes.io/scheme: internet-facing
spec:
  rules:
    - host: randomhost-in-namespace1.com
      http:
        paths:
          - path: /
            backend:
              serviceName: randomhost-in-namespace1 (in first namespace)
              servicePort: 80
</code></pre>
<p><strong>Ingress-namespace2.yaml</strong></p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: random-ingress
  namespace: namespace2
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: my-group
    alb.ingress.kubernetes.io/scheme: internet-facing
spec:
  rules:
    - host: randomhost-in-namespace2.com
      http:
        paths:
          - path: /
            backend:
              serviceName: randomhost-in-namespace2 (in second namespace)
              servicePort: 80
</code></pre>
<p>where both files contain <strong>same group.name</strong> and <strong>differ</strong> by their namespace and host rule.</p>
<p>you can also follow AWS LBC logs to see if everything has been created successfully (should contain no errors on logs):</p>
<pre><code>kubectl logs deploy/aws-load-balancer-controller -n kube-system --follow
</code></pre>
