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 availabilityServices and external accessStorageImages and upgradesIPv6 noteTroubleshooting quick referenceTrademark NoticePostgreSQL 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>).
Services and external access
Every cluster gets three ClusterIP services:
These services are always ClusterIP. Do not change their type with
kubectl edit/patch: the change is not declared anywhere and is
lost whenever the service is recreated (for example after a restore).
To reach the database with a different service type (NodePort,
LoadBalancer), declare an additional service in the Cluster:
- The operator owns the service
selector(fromselectorType), so do not setspec.selector. The service follows the primary across failover and switchover. - Editing
serviceTemplatechanges the live service, including itstype. Removing an entry fromadditionaldeletes that service. updateStrategy: patch(default) applies only the fields you changed in the template since the last reconcile. It does not revert out-of-band edits to the live service. Example: changetypetoClusterIPand back toNodePortwhile keeping a pinnednodePort. The service comes back with a random port, and the operator reports no error. UseupdateStrategy: replaceto force the live service to match the template exactly.replacedeletes and recreates the service on every change, so connections through that service are briefly interrupted and theClusterIP/nodePortmay change unless pinned.- A
LoadBalancerservice needs a load-balancer implementation in the cluster; without one,EXTERNAL-IPstays<pending>. - The admission webhook rejects disabling
rw, reusing a reserved<cluster>-rw/-ro/-rname, and duplicate service names. - Exposing PostgreSQL outside the cluster widens its attack surface.
Restrict clients with
pg_hbaand, forLoadBalancer,spec.loadBalancerSourceRanges.
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.
Troubleshooting quick reference
Trademark Notice
CloudNativePG™ is a trademark of The Linux Foundation.
PostgreSQL® is a registered trademark of the PostgreSQL Community Association of Canada.
Alauda is an independent vendor. This product is not affiliated with, endorsed by, or sponsored by The Linux Foundation, PostgreSQL Community Association of Canada. All trademarks are the property of their respective owners and are used here for identification purposes only.