I'm new to kubernetes and nginx, and am having trouble understanding how to implement Ingress (nginx-ingress) for my particular use case.
I want to expose the pgadmin PostgreSQL admin tool from my cluster.
I have other applications exposed via nginx-ingress from my cluster and I like each to hang off its own subdirectory e.g.:
- myserver.com/purchasing/index.html
- myserver.com/sales/index.html
I have a problem doing this with pgadmin (although the problem would no doubt apply equally to other apps that behave in the same way)
I have set up an Ingress rule to capture and route accordingly:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$2
rules:
- http:
paths:
- path: /pgadmin4(/|$)(.*)
it does the routing and the backend is hit.
However when pgadmin then does a redirect, I lose the pgadmin/ from the redirect URl i.e.
- I send a GET to myserver.com/pgadmin
- I receive a 302 redirect to myserver.com/login
whereas I want redirecting to:
- myserver.com/pgadmin/login
What pieces am I missing to achieve this - it feels like it should be simple?
Thanks