Reputation:
I have application "test.abc.com". I want to transfer request between different service.
Example or Expected output
test.abc.com
--> it will go to abc-demo-frontend-external
servicetest.abc.com/main.js
or test.abc.com/main.css
or any .css/ .js files --> it will go to abc-demo-frontend
serviceI have added below configuration
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test-demo-frontend-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: 'false'
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- host: "test.abc.com"
http:
paths:
- path: /[^\/#?]+\.(?:css|js)(?![^\/?#])
pathType: ImplementationSpecific
backend:
service:
name: abc-demo-frontend
port:
number: 80
- path: /
pathType: ImplementationSpecific
backend:
service:
name: abc-demo-frontend-external
port:
number: 80
after adding [^\/#?]+\.(?:css|js)(?![^\/?#])
path I am getting 503 why ?
when I add below path I am getting 503 why ?
- path: /[^\/#?]+\.(?:css|js)(?![^\/?#])
pathType: ImplementationSpecific
backend:
service:
name: abc-demo-frontend
port:
number: 80
Upvotes: 0
Views: 193
Reputation: 134
The Regex used in the spec.rules.http.paths.path
for K8s ingress-nginx should be comply with RE2 engine syntax; see here. Seems the Regex that you are using does not comply with the RE2 engine syntax. Check it with the supported syntax in https://github.com/google/re2/wiki/Syntax.
Because of this, your ingress-nginx pods should not be ready. Pods are not being ready should be the reason to get 503 - service unavailable issue. Try updating the Regex according to the RE2 syntax and then check it again.
Upvotes: 1