Configuration
How to configure a CloudNativePG Cluster on Alauda Container Platform:
PostgreSQL parameters, users and databases, replication, storage, and
images. For first deployment see the Quick Start; for the architecture
see Architecture.
TOC
PostgreSQL parametersUsers and databasesExtensions and pgauditReplication and high availabilityStorageImages and upgradesIPv6 noteTroubleshooting quick referencePostgreSQL parameters
- A set of parameters is operator-controlled and rejected if set
(
archive_mode,archive_command,restore_command,port,hot_standby,ssl*,synchronous_standby_names,shared_preload_libraries, recovery targets, listen/log/file-path settings). Use the dedicated fields instead:spec.postgresql.shared_preload_libraries,spec.postgresql.synchronous(below). - Commonly tuned parameters (
max_connections,shared_buffers,work_mem,effective_cache_size, autovacuum and checkpoint settings, …) are all allowed. - The operator injects sensible defaults, including
wal_level=logical,archive_timeout=5min,wal_keep_size=512MB, and TLS ≥ 1.3. ALTER SYSTEMis disabled by default (spec.postgresql.enableAlterSystem) — configuration is declarative; changes roll through the cluster governed byspec.primaryUpdateStrategy(unsuperviseddefault) andspec.primaryUpdateMethod(restartorswitchover).pg_hbaentries are inserted between operator-managed fixed rules (local peer access, certificate-authenticated replication) and a trailing default ofhost all all all scram-sha-256.
Users and databases
The bootstrap database and owner come from spec.bootstrap.initdb
(defaults: database app, owner app, credentials in the
<cluster>-app secret). Additional roles are declarative:
Additional databases are their own Database resources:
Superuser access is disabled by default; enable with
spec.enableSuperuserAccess: true (creates the <cluster>-superuser
secret).
Extensions and pgaudit
The standard PostgreSQL operands bundle pgvector, pgaudit, PostGIS,
zhparser, TimescaleDB (Apache-2 OSS, PG 15+), and pg_failover_slots —
all available without the Kubernetes ImageVolume feature gate.
Most extensions are enabled per-database with a Database resource
(spec.extensions, see above) or a plain CREATE EXTENSION. Two are
load-time extensions and must be declared via
spec.postgresql.shared_preload_libraries (the bare shared_preload_libraries
GUC is operator-controlled and rejected):
pgauditmust be configured declaratively. It is an operator-managed extension: a manualCREATE EXTENSION pgauditis dropped on the next restart. Addpgaudittoshared_preload_librariesand setpgaudit.*parameters as above — the operator creates and maintains the extension for you.pg_failover_slotsis preload-only by design (noCREATE EXTENSIONstep): once inshared_preload_librariesit synchronizes logical replication slots to standbys automatically.timescaledbrequiresshared_preload_librariesand is available on PG 15–18 only (no OSS package for PG 14 on Debian trixie). Only the Apache-2 edition is shipped — TSL features (compression, continuous aggregates) are not included.
Replication and high availability
Failover is automatic (the operator promotes the most advanced
replica). Manual switchover is available through the cnpg kubectl
plugin (kubectl cnpg promote <cluster> <instance>).
Storage
Tablespaces are supported via spec.tablespaces (each gets its own
PVC).
Images and upgrades
Operand images default to the version shipped with the operator bundle.
To pin explicitly, set spec.imageName to a PostgreSQL operand image
from your platform registry — always use an immutable tag. Minor
version updates are rolling restarts; major upgrades are declarative
(change the image major; the cluster performs an offline upgrade). See
Upgrade.
IPv6 note
On single-stack IPv6 clusters, operator versions without the
upstream url.Build bracket fix (upstream PR #10682) cannot reach
instance managers over bare IPv6 pod IPs. Dual-stack clusters are
unaffected. Consult the release notes of your operator version.