K8S How to manage incoming traffic for multiple instances of the same app with isolated namespaces and unique subdomains using an Ingress Controller

0 votes

I am new to K8S and need help deploying multiple instances of the same app. Each instance needs to be isolated in its own namespace and must have two exposed services (backend and frontend) accessible via a unique subdomain for each instance.

I want to use an Ingress Controller to redirect traffic to the appropriate services based on the subdomain. However, the problem is that the Ingress Controller cannot access other namespaces, which means it does not know about the other instances of the app.

I thought about putting the Ingress Controller in the kube-system namespace, but I don't think this is a good practice.

Here is an example of the NGINX Ingress Controller that I have started to use (so that you have an idea of what I want to do):

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    nginx.ingress.kubernetes.io/ingress.class: nginx
spec:
  ingressClassName: nginx
  rules:
    - host: sub-01.my-domain.com
      http:
        paths:
          - path: /api/
            pathType: Prefix
            backend:
              service:
                name: sub-01-backend-service
                port:
                  number: 30000
          - path: /
            pathType: Prefix
            backend:
              service:
                name: sub-01-frontend-service
                port:
                  number: 80
    - host: sub-02.my-domain.com
      http:
        paths:
          - path: /api/
            pathType: Prefix
            backend:
              service:
                name: sub-02-backend-service
                port:
                  number: 30000
          - path: /
            pathType: Prefix
            backend:
              service:
                name: sub-02-frontend-service
                port:
                  number: 80

I have also heard about ISTIO, but I am not sure how it could solve my problem.

If you have any ideas or suggestions for solving this problem, I am all ears.

Thanks in advance for your help.

Apr 13, 2023 in DevOps & Agile by anish
• 400 points

edited 4 days ago 11 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP