How can I use an Ingress Controller in K8S to manage traffic for multiple instances of the same application with isolated namespaces and unique subdomains for each instance? I need each instance to have two services (backend and frontend) accessible via their respective subdomains. However, the Ingress Controller cannot access other namespaces, creating an issue in managing traffic. I’ve considered placing the Ingress Controller in the kube-system namespace, but I’m not sure if this is a good practice. I’ve also heard about ISTIO, but I’m unsure if it can solve my problem. Any suggestions or ideas on how to resolve this issue are appreciated.
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
Thanks in advance for your help.