Skip to content

Databases — Connecting with psql

1. Get the credentials

Open the item apps/<team>/postgres-<env>/<name> in the DevOps portal (Secrets). Copy uri, or host / port / database / username / password.

  • port is read-write; ro_port goes to a read-only replica — use it for reporting and ad-hoc queries.

2. Connect

TODO

Confirm whether direct access from laptops over the VPN is allowed per environment, or whether to use kubectl port-forward / a bastion.

psql "postgresql://<username>@<host>:<port>/<database>?sslmode=require"

Or keep the password out of your shell history with ~/.pgpass:

<host>:<port>:<database>:<username>:<password>
chmod 600 ~/.pgpass
psql -h <host> -p <port> -U <username> -d <database>

Monitoring

The database's drawer in the portal links to its Database dashboard in Grafana, filtered to this database and including query statistics (Monitoring).

GUI clients

DBeaver, DataGrip, TablePlus and pgAdmin all work with the same details. Set SSL mode to require.