Can't connect to a DB created from template0

Description

Problem:

Can't connect to a DB created from template0

STR:

  1. Connect to a PG cluster with postgres user

  2. Create a new DB from template0: CREATE DATABASE new TEMPLATE template0;

  3. Connect to the freshly created db (in my case, I used port-forwarding to access the pgbouncer service on localhost: kubectl port-forward svc/postgresql-lyw-pgbouncer 5432:5432 -n everest)


However, here are the workarounds how one could connect to this freshly created db:

  • connect to the db directly, so not via pgbouncer

  • use _crunchypgbouncer user instead of postgres user

  • patch the pg cluster to disable the exposeSuperusers field: kubectl -n everest patch pg/postgresql-lyw -p '{"spec":{"proxy":{"pgBouncer":{"exposeSuperusers":false}}}}' --type=merge. In case of Everest, the everest-operator will immediately reconcile the value back to the true value, however the patch triggers some kind of an update process that makes the new DB accessible. Each time a new DB is created from template0 this patch helps to get access to it:

Environment

None

Activity

Show:

Aaditya Dubey February 24, 2025 at 7:45 AM

Hi

Thank you for the report.

Details

Assignee

Reporter

Needs QA

Yes

Affects versions

Priority

Smart Checklist

Created February 5, 2025 at 4:48 PM
Updated February 24, 2025 at 7:47 AM
Loading...