Aws-load-balancer-controller: need guidance on multiple namespace and url pattern

Created on 17 Jan 2020  路  6Comments  路  Source: kubernetes-sigs/aws-load-balancer-controller

I am doing PoC and here I got stuck.
I have one cluster. in this cluster, there are multiple namespaces.
say ns1, ns2, ns3
each namespace holds multiple pods, say p1, p2, p3 etc pod contains only 1 docker container. Their docker containers are basically services. So there are multiple products and each product contains multiple micro-services services.
I want to get final urls like

https://ns1-api.mydomain/service1
https://ns1-api.mydomain/service2
https://ns2-api.mydomain/service3
https://ns3-api.mydomain/service4

Or url can also be like

https://ns1-service1-api.mydomain/
https://ns1-service2-api.mydomain/
https://ns2-service3-api.mydomain/
https://ns3-service4-api.mydomain/

I am confused at few things.

Here is the code for creating ingress

const router1 = new k8s.networking.v1beta1.Ingress(
  'syngenta-platform',
  {
    metadata: {
      name: 'syngenta-platform',
      labels: {
        app: 'syngenta-platform'
      },
      namespace: appSynPlatform.NS.metadata.name,
      annotations: {
        'kubernetes.io/ingress.class': 'alb',
        'alb.ingress.kubernetes.io/scheme': 'internet-facing'
      }
    },
    spec: {
      rules: [
        {
          host: 'api.syn-platform.com', // TODO what is this?
          http: {
            paths: [
              {
                path: '/ndvi/*',
                backend: {
                  serviceName: appSynPlatform.services.ndvi.service.metadata.name,
                  servicePort: 'http'
                }
              },
              {
                path: '/nginx/*',
                backend: {
                  serviceName: appSynPlatform.services.nginx.service.metadata.name,
                  servicePort: 'http'
                }
              }
            ]
          }
        }
      ]
    }
  },
  {
    provider: synPlatformCluster.provider
  }
);

this give things like

get ingress -o=wide --all-namespaces

NAMESPACE           NAME                HOSTS                  ADDRESS                                                                  PORTS   AGE
syngenta-platform   syngenta-platform   api.syn-platform.com   e9275192-syngentaplatform--87b5-1276037906.us-east-1.elb.amazonaws.com   80      3d21h

kubectl get pods -o wide --show-labels --all-namespaces

NAMESPACE           NAME                                            READY   STATUS    
default             alb-aws-alb-ingress-controller-66cbc84d-m8fmh   1/1     Running

it is showing that "ingress" is in the namespace but the pod is in the default namespace.
is this a mistake?
Do I need to copy-paste the above code and create another ingress service in a different namespace or just add more rules in the above code?

lifecyclstale

All 6 comments

Hi, under current implementation, the ingress must be the same namespace as the service(also the pod).
You'll need to create different ingress in different namespace.

Also, the host in the ingress spec defines a rule on ALB to see if HTTP requests matches host, route to this service.

Is there any plan on the roadmap for alb-ingress-controller to support multi-namespace services in the future? This could truly give the advantage of using a single ALB instead of multiple CLBs. At the moment it would force having 1 ALB for each namespace, which is equivalent to our current architecture where there is 1 CLB per environment (because each environment matches a namespace in our EKS cluster)

+1

Is there any update for this can we get support for multiple name spaces.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@julianguinard @nsisodiya
With our latest v2.0.0 release, you can now create multiple Ingress hosted by a single ALB.
please checkout our IngressGroup feature: https://kubernetes-sigs.github.io/aws-load-balancer-controller/guide/ingress/annotations/#ingressgroup

closing this issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gigi-at-zymergen picture gigi-at-zymergen  路  5Comments

NickEAVE picture NickEAVE  路  3Comments

rdubya16 picture rdubya16  路  4Comments

brylex418 picture brylex418  路  4Comments

rootd00d picture rootd00d  路  4Comments