Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Create a new DB from template0: CREATE DATABASE new TEMPLATE template0;
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:
Problem:
Can't connect to a DB created from
template0
STR:
Connect to a PG cluster with
postgres
userCreate a new DB from
template0
:CREATE DATABASE new TEMPLATE template0;
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 ofpostgres
userpatch 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 thetrue
value, however the patch triggers some kind of an update process that makes the new DB accessible. Each time a new DB is created fromtemplate0
this patch helps to get access to it: