Im struggling with the ingress configuration that will allow accessibility from two different paths to services which are deployed on different namespaces.
1# Ingress:
# Source: deployment/templates/ingress.yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: portal-api
labels:
helm.sh/chart: deployment-0.1.0
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: portal-api
app.kubernetes.io/version: "0.0.1"
app.kubernetes.io/managed-by: Helm
annotations:
certmanager.k8s.io/acme-challenge-type: http01
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
kuberentes.io/tls-acme: "true"
kubernetes.io/ingress.class: nginx
spec:
tls:
- hosts:
- "example.com"
secretName: portal-certificate
rules:
- host: "example.com"
http:
paths:
- path: /api/rest/(.*)
backend:
serviceName: portal-api
servicePort: 80
2 Ingress
# Source: deployment/templates/ingress.yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: portal-ui
labels:
helm.sh/chart: deployment-0.1.0
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: portal-ui
app.kubernetes.io/version: "0.0.1"
app.kubernetes.io/managed-by: Helm
annotations:
certmanager.k8s.io/acme-challenge-type: http01
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
tls:
- hosts:
- "example.com"
secretName: portal-certificate
rules:
- host: "example.com"
http:
paths:
- path: /(.*)
backend:
serviceName: portal-ui
servicePort: 80
Routing for path example.com - works, its redirect to portal-ui. Routing for path example.com/api/rest/(something) - doesnt works, its redirect to portal-ui service.
I think that It will works on the same namespace... But i need two namespaces for each service.