Postgres user: no such user. What user has permissions to create a database?

I need a user with priveleges to create new databases in a fresh new installed cluster.
I use postgres user that supposed to be created by Percona operator. Operator version is 1.1.0

helm install postgresql percona/pg-db --namespace postgre --version "1.1.0"  
export POSTGRES_PASSWORD=$(kubectl -n postgre get secrets postgresql-pg-db-postgres-secret -o jsonpath="{.data.password}" | base64 --decode)
export POSTGRES_USER=$(kubectl -n postgre get secrets postgresql-pg-db-postgres-secret -o jsonpath="{.data.username}" | base64 --decode)

 kubectl run -i --rm --tty percona-client --image=perconalab/percona-distribution-postgresql:13.2 --restart=Never \
  -- psql "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgresql-pg-db-pgbouncer.postgre.svc.cluster.local/pgdb"

psql: error: FATAL:  no such user
pod "percona-client" deleted
pod default/percona-client terminated (Error)

The secret for postgres user and password is created, but PostgreSQL server has no such user.
Why? How to fix?

Server has only pguser defined, but this one has no permission to create a new database.

1 Like

For security reasons we do not expose postgres user through pgBouncer.
To connect to it please connect directly to pgPrimary node.

I think we are going to change it in the next release, as seems it is unexpected by lots of users.
So just connect to postgresql-pg-db-cluster service instead of pgBouncer.

1 Like

Hi @Sergey_Pronin,

For the release that was release today (March 28), should we now be able to login as postgres through pgbouncer? Thanks.

1 Like

Hey @jason123 ,

no, it is going to land in 1.3.0 version. Coming in Q2.

2 Likes