Score:1

Pgadmin4 cannot start in Kubernetes

in flag

I have set up Postgres in Kubernetes (k3s administered with Rancher) which seems to be working fine but in order to take a look at the databases I tried to add a pgadmin4 pod.

I first tried adding the image dpage/pgadmin4 without any additional configuration (except for the a node port from port 80 and the PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD env var), got the error below and tried a few things since then:

  • set PGADMIN_LISTEN_ADDRESS env var to 0.0.0.0 in case IPv6 is not supported
  • add a volume mount (from longhorn) for /var/lib/pgadmin

The pod is failing to start with the following log messages:

NOTE: Configuring authentication for SERVER mode.
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
[2022-03-30 08:27:31 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2022-03-30 08:27:31 +0000] [1] [ERROR] Retrying in 1 second.
[2022-03-30 08:27:32 +0000] [1] [ERROR] Retrying in 1 second.
[2022-03-30 08:27:33 +0000] [1] [ERROR] Retrying in 1 second.
[2022-03-30 08:27:34 +0000] [1] [ERROR] Retrying in 1 second.
[2022-03-30 08:27:35 +0000] [1] [ERROR] Retrying in 1 second.
[2022-03-30 08:27:36 +0000] [1] [ERROR] Can't connect to ('0.0.0.0', 80)

There seem to be two things wrong:

  • the sudo error, which results from pgadmin4 starting with userid 5050 but I don't know how to solve this
  • gunicorn not being able to listen on port 80

I am not very familiar with Kubernetes so I just don't know which options I have to fix this.

Thanks in advance for any help.

Mikołaj Głodziak avatar
id flag
Which version of Kubernetes did you use and how did you set up the cluster (your config file)? Did you use bare metal installation or some cloud provider? It is important to reproduce your problem.
cn flag
I am able to help get the sudo error to go away. It involves creating an init container using the image 'busybox' and executing the command chown -R 5050:5050 /var/lib/pgadmin
Score:0
cn flag

After troubleshooting this myself, on Kubernetes with Rancher, I've found that you'll need an init container to get started. This can be tricky from the UI but you have to go out to the workloads section to get to it. (Click the ellipses). Make sure to mount your pgadmin volume in specific place, for the sake of sanity we'll call it /var/lib/pgadmin

Use the image busybox and run the command:

chown -vR 5050:5050 /var/lib/pgadmin

Then you'll also want to set the environment variable for the deployment to something higher than 1024, I chose 5050, using the environment variable:

PGADMIN_LISTEN_PORT: 5050
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.