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.