PostgreSQL server parameters
Usespec.config.parameters to set values in postgresql.conf. The field accepts a map of parameter names to values. PGO applies these to the running cluster; some parameters are reloaded live while others require a PostgreSQL restart.
The
parameters map accepts up to 50 entries. Several parameters are reserved and will be rejected by validation: listen_addresses, port, ssl, hot_standby, wal_log_hints, archive_mode, archive_command, restore_command, synchronous_standby_names, primary_conninfo, primary_slot_name, logging_collector, cluster_name, and paths like config_file, data_directory, hba_file, ident_file, external_pid_file. Use spec.port to change the PostgreSQL port.Mount custom configuration files
Usespec.config.files to mount projected volumes into /etc/postgres. This is useful for providing pg_hba.conf fragments or other configuration files that PostgreSQL reads from that directory.
Run SQL after cluster initialization
spec.databaseInitSQL lets you run arbitrary SQL against the cluster after it has been initialized. You provide a ConfigMap in the same namespace, specifying which key holds the SQL string.
DatabaseInitSQL status field on the cluster reflects whether initialization has been applied.
Custom container image and pull secrets
Specify a custom PostgreSQL image withspec.image. When omitted, the operator uses the environment variable RELATED_IMAGE_POSTGRES_{postgresVersion}.
imagePullSecrets accepts a list of LocalObjectReference values. Changing this value causes all running pods to restart.
Pod scheduling constraints
Each instance set supports the full set of Kubernetes scheduling primitives. These are set directly on the instance set and cause a rolling restart when changed.Node selector and affinity
Tolerations
Topology spread constraints
Disable default scheduling
By default, PGO applies scheduling constraints to spread pods across nodes. To rely entirely on your own constraints, setspec.disableDefaultPodScheduling: true.
Custom sidecars
TheInstanceSidecars feature gate (alpha, enabled by default) allows you to add custom sidecar containers to instance pods via spec.instances[].containers.
containers field causes PostgreSQL to restart.
There is also a
PGBouncerSidecars feature gate (alpha, disabled by default) for adding custom sidecars to pgBouncer pods. See Feature Gates.Metadata labels and annotations
Usespec.metadata to apply additional labels and annotations to all resources that PGO manages for this cluster. This is useful for cost allocation, policy enforcement, or integrating with external tooling.
spec.instances[].metadata:
Next steps
Use tablespaces
Mount additional volumes as PostgreSQL tablespaces.
PostgresCluster reference
Complete API reference for all PostgresCluster spec fields.