application-gateway-kubernetes-ingress
application-gateway-kubernetes-ingress copied to clipboard
Define path priority
Hi,
I'm trying to deploy a big application with Azure AGIC but I'm facing an issue I can't resolve for now.
- /api/*
- /api/other-service-a/*
- /api/other-service-b/*
As you can see, I have multiple services on the same path prefix.
But /api/*
is taking over the others resulting in 404s. Is this possible to specify an order in ingress ?
When specifying in AppGateway, it works for like 10s but then is updated from AGIC.
Regards,
@VincentSurelle Can you please share your ingress spec ?
Also, is your application able to respond at /api/other-service-a/* or does it need the request come at /. This may also explain the 404s.
For example: Do you need /api/other-service-a/xyz to be rewritten to /xyz ? If yes, then you might want to use appgw.ingress.kubernetes.io/backend-path-prefix: ""
annotation in the ingress.
I would also like to know a bit more about how path priority is handled. Is there such a thing as "longest length priority" for example? Or would it be possible to set the priority to a path? Here's a little example from traefik: https://docs.traefik.io/routing/routers/#priority
I second/third that request for info on whether or not this is supported by AGIC. i.e., is there a corresponding mechanism to ingress-nginx's longest-rule matching, https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/#path-priority , or some other way to control matching order.
I know that this is old but someone else might face similar issue, to solve it you just have to change name in ingress, so if you want to have order like:
/api/other-service-a/* /api/other-service-b/* /api/*
then in Ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: azure/application-gateway
name: a
spec:
path: /api/other-service-a/*
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: azure/application-gateway
name: b
spec:
path: /api/other-service-b/*
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: azure/application-gateway
name: c
spec:
path: /api/*
@lukaszchwastyk Can you let me know which version of AGIC you are using ? I've tried with 1.5.1 but the alphabetical ordering was not preserve neither. Thanks !
@rbickel I'm also using version 1.5.1
I removed some parts from the yaml (not relevant)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: azure/application-gateway
name: a-sitemap
namespace: chaos-testing
spec:
rules:
- host: test.e-e.com
http:
paths:
- backend:
service:
name: fe-shop
port:
number: 80
path: /api/other-service-a/*
pathType: ImplementationSpecific
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: azure/application-gateway
name: b-sitemap
namespace: chaos-testing
spec:
rules:
- host: test.e-e.com
http:
paths:
- backend:
service:
name: fe-shop
port:
number: 80
path: /api/other-service-b/*
pathType: ImplementationSpecific
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: azure/application-gateway
name: c-sitemap
namespace: chaos-testing
spec:
rules:
- host: test.e-e.com
http:
paths:
- backend:
service:
name: fe-shop
port:
number: 80
path: /api/*
pathType: ImplementationSpecific