pg_hba.conf through the spec.authentication field.
Default user and database
PGO creates one PostgreSQL user and one database by default, both named after the PostgresCluster resource. For a cluster namedhippo, this means:
- PostgreSQL user:
hippo - PostgreSQL database:
hippo - Credentials Secret:
hippo-pguser-hippo
spec.users to an empty list ([]), which instructs PGO to create no users at all.
Reading connection credentials
PGO stores connection details for each user in a Secret named<cluster>-pguser-<username>. The Secret contains the following keys:
The
dbname, uri, and jdbc-uri keys are only populated when at least one database is listed in spec.users[].databases. If no database is specified, those keys are absent.
To retrieve credentials for the default user:
Creating additional users
Declare extra users inspec.users. Each entry requires a name and optionally lists databases, role attributes, and a password format:
User field reference
The
options and databases fields are ignored for the built-in postgres superuser.Customizing authentication rules (pg_hba.conf)
PGO writespg_hba.conf based on mandatory rules it controls (for monitoring, PgBouncer, and replication) plus any rules you define in spec.authentication.rules. Rules are evaluated in the order they appear; the first match determines whether and how the connection authenticates.
When spec.authentication.rules is omitted or empty, PGO applies a default that accepts encrypted connections from any user with a password. To customize rules, set spec.authentication:
PostgresHBARuleSpec:
Example: require certificate authentication
Example: raw HBA line
For advanced cases where you need a line not expressible via structured fields, use thehba key:
Rules written using
hba are inserted verbatim into pg_hba.conf without validation. Include files (include, include_if_exists, include_dir) are not permitted.Related pages
- TLS encryption — configuring server and replication certificates
- Create a cluster — full cluster creation walkthrough
- Connection pooling — PgBouncer setup and the extra Secret keys it populates
- PostgresCluster reference — complete spec field documentation