Skip to main content
PGO requires TLS for every PostgreSQL connection — there is no option to run a cluster in plaintext mode. By default, PGO manages the full certificate lifecycle for you: it generates a self-signed root CA, a server certificate, and a replication client certificate, and rotates them automatically before they expire. If your organization requires certificates issued by an external authority, you can supply them via the customTLSSecret and customReplicationTLSSecret fields.

How PGO-managed PKI works

When no custom secret is provided, PGO creates and maintains three X.509 artifacts per cluster namespace: The root CA is stored in a namespace-scoped Secret named postgres-operator-ca-secret. Each PostgresCluster gets its own leaf certificate (in a separate Secret) with DNS SANs covering the cluster’s primary and replica Services. PGO checks the leaf certificate on every reconciliation and regenerates it when it reaches one-third of its remaining validity period.
One root CA secret is created per namespace. Multiple PostgresCluster resources in the same namespace share that CA, but each cluster gets its own leaf certificate.

Bring your own TLS certificates

To use certificates issued by your own CA, set spec.customTLSSecret on the PostgresCluster. This field is a Kubernetes SecretProjection, which lets you reference a Secret (and optionally remap key names) that PGO will mount at /pgconf/tls inside each PostgreSQL container.
If you set customTLSSecret, you must also set customReplicationTLSSecret. Both secrets must share the same CA certificate in their ca.crt key, or replication will fail to establish a TLS connection.

Required secret keys

Your secret must contain exactly these three keys:

Creating the TLS secret

1

Generate or obtain your certificates

Produce a server certificate whose Subject Alternative Names include the cluster’s Service DNS names. For a cluster named hippo in the postgres-operator namespace, the primary Service DNS name follows the pattern:
You also need a separate client certificate for replication.
2

Create the Kubernetes Secrets

3

Reference the secrets in your PostgresCluster

Using SecretProjection to remap keys

If your existing secret uses different key names, use the items field of the SecretProjection to remap them without modifying the secret itself:
The path values in the items list must always be tls.crt, tls.key, and ca.crt — those are the file names that PostgreSQL is configured to read from /pgconf/tls.

Rotating certificates

No action is required. PGO automatically generates a new leaf certificate when the existing one reaches one-third of its remaining lifetime and applies it without cluster downtime.