I'm trying to write 2 ingress rules for my nginx ingress controller on my microk8s cluter:
api
service). The RPC paths all follow the pattern: /thing.v1.ThingService/AMethod
, e.g: /pizzas.v1.PizzasService/ListFlavours
fe
service)This is what I have:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fanout-ingress
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
cert-manager.io/issuer: letsencrypt-prod
spec:
ingressClassName: nginx
rules:
- host: dev.fancy.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: fe
port:
number: 80
tls:
- hosts:
- dev.fancy.com
secretName: letsencrypt-prod-tls
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fanout-ingress-grpc
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
nginx.ingress.kubernetes.io/backend-protocol: 'GRPC'
cert-manager.io/issuer: letsencrypt-prod
spec:
ingressClassName: nginx
rules:
- host: dev.fancy.com
http:
paths:
- path: "/.*Service.*"
pathType: ImplementationSpecific
backend:
service:
name: api
port:
number: 8080
tls:
- hosts:
- dev.fancy.com
secretName: letsencrypt-prod-tls
In this configuration, calling /pizzas.v1.PizzasService/ListFlavours
doesn't work, it returns a 404.
If I use this more specific config in the fanout-ingress-grpc
rule, everything works:
http:
paths:
- path: /pizzas.v1.PizzasService/ListFlavours"
pathType: ImplementationSpecific
So it looks it's the regex that doesn't work. Could you give me any pointer please?
According to the documentation, You can use this annotation:
nginx.ingress.kubernetes.io/use-regex: "true"