I have a problem with nginx Ingress. We have rules in different namespaces and test apps work fine.
Now we want to access a new application over the ingress, but for this one we need another URL rule:
f.e. Rule path: /app/app-function
Fortunately the app shows me the URI it gets. The App gets the Path from the ingress, I need to change it to something. I try app-root and rewrite-target but I can not see any changes in the URI.
Pasting my yaml file below. Do you have any idea? I tried it in the master rule too, but nothing happend. But the master rule is in the ingress namespace...
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rule-app
namespace: pilot
annotations:
nginx.org/mergeable-ingress-type: "minion"
nginx.ingress.kubernetes.io/rewrite-target: "/test"
#nginx.ingress.kubernetes.io/enable-rewrite-log: "true"
spec:
ingressClassName: "nginx"
rules:
- host: "Host"
http:
paths:
- path: /app/app-function
pathType: Prefix
backend:
service:
name: new-app
port:
number: 8080
Thank you Vit, I found a solution with your tipp.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rule-app
namespace: pilot
annotations:
nginx.org/mergeable-ingress-type: "minion"
nginx.org/rewrites: "serviceName=new-app rewrite=/test"
spec:
ingressClassName: "nginx"
rules:
- host: "Host"
http:
paths:
- path: /app/app-function
pathType: Prefix
backend:
service:
name: new-app
port:
number: 8080