0

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.

1 Answer 1

0

https://doc.traefik.io/traefik/ seems to fit your usecase.

" Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience. It receives requests on behalf of your system and finds out which components are responsible for handling them. "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.