Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need guidance on multiple namespace and url pattern #1137

Closed
nsisodiya opened this issue Jan 17, 2020 · 6 comments
Closed

need guidance on multiple namespace and url pattern #1137

nsisodiya opened this issue Jan 17, 2020 · 6 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@nsisodiya
Copy link

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?

@M00nF1sh
Copy link
Collaborator

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.

@julianguinard
Copy link

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)

@luizsfer
Copy link

+1

@sveerabathini
Copy link

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

@fejta-bot
Copy link

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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 6, 2020
@M00nF1sh
Copy link
Collaborator

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

7 participants