I deployed 2 front-end applications that are based on angular. I use ingress-nginx (k8s.gcr.io/ingress-nginx/controller:v0.44.0
) with the following configurations to route the requests to these applications:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: portal-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /?(.*)
backend:
serviceName: app1
servicePort: 80
- path: /app2
backend:
serviceName: app2
servicePort: 80
When I hit the <ip-address>/
it is routing to app1, but when I hit <ip-address>/app2
it is routing back to app1.