I have a static micro service (static-content
service), which has following endpoints to simple HTML pages, using react
- blog
- about-us
- map
I also have my Web server dynamic front (react-nextjs-content
service) end also running on React/ nextJs.
I want to implement ingress rules to static micro service like below
<host-url>/
should route to index page
of the static-content
service
<host-url>/blog
will route to blog
endpoint of static-content
service
<host-url>/about-us
will route to about-us
endpoint of static-content
service
<host-url>/map
will route to map
endpoint of static-content
service
Every other endpoint shoud route to react-nextjs-content
service
I am using following ingress implantation on EKS (K8 version 1.22), but it seems routing not achieved
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myingress
labels:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: ruwanvm.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: static-content
port:
number: 3000
- path: /blog
pathType: Prefix
backend:
service:
name: static-content
port:
number: 3000
- path: /about-us
pathType: Prefix
backend:
service:
name: static-content
port:
number: 3000
- path: /map
pathType: Prefix
backend:
service:
name: static-content
port:
number: 3000
- path: /.+
pathType: Prefix
backend:
service:
name: react-nextjs-service
port:
number: 3000
Can anyone support where I have not configured correctly
All services are exposed as clusterIP services and nginx ingress controller is set up to serve traffic through NLB on AWS