I have a weird problem with PGAdmin4.
My setup
pgadmin4.1 deployed onkubernetesusing thechorss/docker-pgadmin4image. One POD only to simplify troubleshooting;Nginx ingress controlleras reverse proxy on the cluster;Classic ELBin front to load balance incoming traffic on the cluster.
ELB <=> NGINX <=> PGADMIN
From a DNS point of view, the hostname of pgadmin is a CNAME towards the ELB.
The problem
Application is correctly reachable, users can login and everything works just fine. Problem is that after a couple of (roughly 2-3) minutes the session is invalidated and users are requested to login again. This happens regardless of the fact that pgadmin is actively used or not.
After countless hours of troubleshooting, I found out that the problem happens when the DNS resolution of ELB's CNAME switches to another IP address.
In fact, I tried:
- connecting to the pod directly by connecting to the
k8s service's node port directly => session doesn't expire; - connecting to
nginx(bypassing the ELB) directly => session doesn't expire; - mapping one of the ELB's IP addresses in my hosts file => session doesn't expire.
Given the above test, I'd conclude that the Flask app (PGAdmin4 is a Python Flask application apparently) is considering my cookie invalid after the remote address changes for my hostname.
Any Flask developer that can help me fix this problem? Any other idea about something I might be missing?