pgadmin > nginx > kubernetes (nginx) ingress (too many redirects)

Viewed 477

I have just successfully installed pgadmin app on Kubernetes but I am having troubles with ingress nginx.

I have an internal reversed proxy in front of pgadmin app to host it under a subdirectory. I am simply following documentation to achieve that. The nginx.conf file looks like this:

user nginx;
worker_processes  1;
events {
  worker_connections  10240;
}
http {
  server {
    listen       80;
    server_name  _;

    location /pgadmin4/ {
      proxy_set_header X-Script-Name /pgadmin4;
      proxy_set_header Host $http_host;
      proxy_pass http://pgadmin;
      proxy_redirect off;
    }
  }
}

It works fine, I can access the website with no problem if I directly access the node where the app runs on.

Now I want an ingress rule to have the app accessible on http://mycompanydomain.com/pgadmin4. The ingress server is a kubernetes nginx server which I don't administrate myself. And I would say this is where I am getting troubles with. My ingress rule is as simple as:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: pgadmin
  namespace: ...
spec:
  rules:
    - http:
        paths:
          - path: /pgadmin4
            pathType: Prefix
            backend:
              serviceName: pgadmin-nginx
              servicePort: 80

Now I am left with a some redirect loop and the page cannot be served:

enter image description here

I have tried a whole combination of settings to no success and spent too much time on it and I am afraid I need a deeper knowledge on nginx.

0 Answers
Related