I would like to deploy 2 different react apps (exposed as Nodeport services) in a single kubernetes cluster. Exposing them on separate ingresses work fine and i see the react page for each. i.e. for service web1
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: fanout-ingress-1
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: web1
servicePort: 5000
Same works with serviceName: web2
. However, Trying to merge both as a fanout ingress only shows one of the services (web1):
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: fanout-ingress
annotations:
kubernetes.io/ingress.class: "gce"
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: web1
servicePort: 5000
- path: /web2/*
backend:
serviceName: web2
servicePort: 5000
Is it possible to expose 2 react apps on a single Ingress?
Yes it's possible but I think your second path (path: /web2/) will be ignored since the first one (path: /) routes everything after / to web1. Try changing the first route to something like (path: /web1/*). Something like this:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: fanout-ingress
annotations:
kubernetes.io/ingress.class: "gce"
ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /web1/*
backend:
serviceName: web1
servicePort: 5000
- path: /web2/*
backend:
serviceName: web2
servicePort: 5000