I have a situation like this:
internet
|
[ IngressController -namespace:kube-sustem ]
| |
[ Ingress A -namespace:ocelot-ns] [ Ingress B -namespace:private-ns]
--|-----|-- --|-----|--
[ Service ocelot] [ Service userservice]
| |
[ Pod A] [ Pod B]
Ingres A and Ingres B do not route more complex paths that should be resolved by regex rule, it seems like the regex is not working. example from ingress A yaml:
This combination does not work:
anotations:
kubernetes.io/ingress.class: addon-http-application-routing
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/ssl-redirect: 'false'
nginx.ingress.kubernetes.io/use-regex: 'true'
path: /gateway(/|$)(.*)
pathType: ImplementationSpecific
backend:
serviceName: ocelot
servicePort: 80
This combination works:
kubernetes.io/ingress.class: addon-http-application-routing
path: /gateway
pathType: ImplementationSpecific
backend:
serviceName: ocelot
servicePort: 80
When I try to curl from Pod A(ocelot gateway) I can get response from pod B curl -v http://localhost/gateway/api/test
This is working ocelot config:
"DownstreamHostAndPorts": [
{
"Host": "userservice.private-ns",
"Port": "80"
}
],
"UpstreamPathTemplate": "/gateway/api/test",
I'm stuck here :/ What I would like to have is one api-gateway(ocelot) and other apps behind it. So I think need to configure ingress A to handle any path since this will route everything to ocelot api gateway.
I started doing it this way, not sure if this is ok since I'm Kubernetes beginner. FYI I'm using Azure Kubernetes service