Skip to content

pgAdmin

Web UI for Postgres, deployed per environment via the Runix pgadmin4 Helm chart. Each environment connects to its own CNPG cluster (see Postgres).

Argo CD Application

k8s/envs/<env>/pgadmin/application.yaml uses the multi-source pattern:

  • Chart: https://helm.runix.net/pgadmin4 at 1.70.4.
  • Values: $values/k8s/envs/<env>/pgadmin/values.yaml from this repo.

Both apps deploy into the data namespace alongside Postgres.

Server definition

serverDefinitions.enabled: true pre-registers the per-env Postgres so the first-time login lands on a populated server tree:

Env Server name Host User
dev Tomoda-Dev-Postgres postgres-postgresql tomoda_dev_user
prod Tomoda-Prod-Postgres postgres-prod-postgresql tomoda_prod_user

Both connect on port 5432 with SSLMode: prefer. The hostnames are the ExternalName aliases that point at the CNPG -rw Service.

The pgAdmin login email is env.email in values.yaml (admin-<env>@tomoda.life); its password comes from the pgadmin-<env>-credentials Secret, an ExternalSecret over GSM tomoda-pgadmin-password-<env>. These gate the pgAdmin UI itself, not the Postgres connection. The Postgres password is not pre-filled by the chart; the operator enters it interactively after authenticating to pgAdmin.

Ingress and auth

Both envs ship an Ingress:

Env Host Auth
dev pg-admin-dev.tomoda.life oauth2-proxy (Google) middlewares
prod pg-admin-prod.tomoda.life oauth2-proxy (Google) middlewares

The traefik.ingress.kubernetes.io/router.middlewares annotation chains sys-oauth2-proxy-errors and sys-oauth2-proxy-auth, so every request hits oauth2-proxy first and is bounced through Google sign-in (restricted to tomoda.life accounts). An additional path /oauth2 on the same Ingress routes to the oauth2-proxy-redir Service for the callback dance. TLS is provisioned by cert-manager into pgadmin-dev-tls / pgadmin-prod-tls.

kubectl -n data port-forward svc/<release>-pgadmin4 8080:80 bypasses the OAuth flow for local access.

Operations

  • Reset login password: add a new version of tomoda-pgadmin-password-<env> in GSM (or scripts/setup-gcp-secrets.sh --rotate), wait for the ExternalSecret refresh, then restart the pod.
  • Add a server: extend serverDefinitions.servers and re-sync. Existing servers in the user's profile are not overwritten.
  • Chart upgrade: adjust targetRevision; check the chart changelog for value-schema changes.