Reference / Package catalog
cnpg-cluster
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
PostgreSQL cluster run by the CloudNativePG operator (Cluster)
This page is generated from kix/packages/stable/cnpg-cluster.
| Stability | Stable |
package value | packages.cnpg-cluster |
| Default aliases | postgres |
Dependencies
Section titled “Dependencies”Kix matches each dependency below to another package instance by instance name, alias, or role. To bind a specific instance, set deps.<name> in your cluster definition. See Declaring dependencies for how required and optional dependencies work.
| Dependency | Requirement |
|---|---|
cnpgOperator | Required |
barmanCloud | Optional |
cloudIdentity | Optional |
endpointService | Optional |
importCa | Optional |
importPassword | Optional |
importSource | Optional |
prometheus | Optional |
storageClasses | Optional |
storageCredentials | Optional |
Options
Section titled “Options”backup
Section titled “backup”WAL archiving and scheduled base backups to S3 through the Barman Cloud
plugin. Requires the barmanCloud and storageCredentials dependencies
when set. Pass a Secret instance with S3 access keys or an AWS IAM role
(kix.cloudIdentity.aws { roleArn = "..."; }) as storageCredentials.
- Type:
null or (submodule) - Default:
null
backup.credentialKeys.accessKeyId
Section titled “backup.credentialKeys.accessKeyId”Key in the storageCredentials Secret that holds accessKeyId. Defaults to accessKeyId when null. Cannot be set when storageCredentials is a cloud identity.
- Type:
null or non-empty string - Default:
null
backup.credentialKeys.region
Section titled “backup.credentialKeys.region”Key in the storageCredentials Secret that holds the S3 region. When null, no region key is read from the Secret. Cannot be set when storageCredentials is a cloud identity.
- Type:
null or non-empty string - Default:
null
backup.credentialKeys.secretAccessKey
Section titled “backup.credentialKeys.secretAccessKey”Key in the storageCredentials Secret that holds secretAccessKey. Defaults to secretAccessKey when null. Cannot be set when storageCredentials is a cloud identity.
- Type:
null or non-empty string - Default:
null
backup.destinationPath
Section titled “backup.destinationPath”Where WAL and base backups go, as s3://<bucket>[/<prefix>] (configuration.destinationPath). The plugin writes under serverName.
- Type:
string matching the pattern s3://[^/]+(/.*)? - Example:
"s3://pg-backups/main"
backup.endpointScheme
Section titled “backup.endpointScheme”Scheme of the endpointService dependency’s URL in configuration.endpointURL (null means http). Set only with an endpointService dependency.
- Type:
null or one of "http", "https" - Default:
null
backup.extraSpec
Section titled “backup.extraSpec”Merged over the ObjectStore spec. Refused:
configuration.destinationPath, configuration.s3Credentials,
retentionPolicy, and, with an endpointService dependency,
configuration.endpointURL. An endpointURL pointing to an
in-cluster .svc hostname is refused; wire endpointService
instead.
-
Type:
attribute set of anything -
Default:
{ } -
Example:
1{2configuration = {3endpointURL = "https://s3.example.com";4wal = {5compression = "gzip";6};7};8}
backup.retention
Section titled “backup.retention”Retention window (retentionPolicy on ObjectStore): a number followed by d, w, or m. Null keeps everything.
- Type:
null or string matching the pattern [1-9][0-9]*[dwm] - Default:
null - Example:
"30d"
backup.schedule
Section titled “backup.schedule”When to take a base backup (spec.schedule on ScheduledBackup): six cron fields with seconds first, or @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly, or @every <duration>.
- Type:
non-empty string - Default:
"0 0 0 * * *"
backup.serverName
Section titled “backup.serverName”Folder under destinationPath that this Cluster archives to
(the plugin’s serverName parameter). Null uses
<namespace>-<instance>.
- Type:
null or string matching the pattern [A-Za-z0-9][-A-Za-z0-9._]* - Default:
null - Example:
"pg"
extraSpec
Section titled “extraSpec”Merged over the Cluster spec. Refused: instances, imageName,
imageCatalogRef, resources, storage.size, storage.storageClass,
affinity.enablePodAntiAffinity, monitoring.enablePodMonitor,
bootstrap.initdb.import (set import instead), when backup is
set, plugins and backup.barmanObjectStore, and, when import is
set, externalClusters, bootstrap.recovery, and
bootstrap.pg_basebackup.
topologySpreadConstraints replaces the spread derived from the
availability level, and enablePDB replaces the package default.
-
Type:
attribute set of anything -
Default:
{ } -
Example:
1{2postgresql = {3parameters = {4max_connections = "200";5};6};7}
PostgreSQL operand image (spec.imageName). The tag must start with the PostgreSQL version. The standard images include contrib extensions, pgvector, pgaudit, and pg_failover_slots.
-
Type:
submodule -
Default:
1{2digest = "sha256:37fdeea29a4d3ed14570f719488ba55bd21e8975eaea864be5ce74d25a9a13de";3pullPolicy = "IfNotPresent";4repository = "ghcr.io/cloudnative-pg/postgresql";5tag = "18.7-standard-trixie";6}
image.digest
Section titled “image.digest”Resolved manifest digest, sha256: followed by 64 hex characters. What will actually run. Null means not resolved.
- Type:
null or string - Default: the package’s digest while
tagis the package’s tag, otherwise null
image.note
Section titled “image.note”Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.
- Type:
null or string - Default:
null
image.promotedBy
Section titled “image.promotedBy”Who resolved this pin, for the record. Null when unknown.
- Type:
null or string - Default:
null
image.pullPolicy
Section titled “image.pullPolicy”imagePullPolicy for containers using this image. Null leaves it to Kubernetes.
- Type:
null or string - Default:
"IfNotPresent"
image.repository
Section titled “image.repository”Image repository, registry host included.
- Type:
string - Default:
"ghcr.io/cloudnative-pg/postgresql"
image.resolvedAt
Section titled “image.resolvedAt”When this pin was resolved, RFC 3339. Null when unknown.
- Type:
null or string - Default:
null
image.sourceRev
Section titled “image.sourceRev”Revision of the source the image was built from, when Kix built it. Null for upstream images.
- Type:
null or string - Default:
null
image.tag
Section titled “image.tag”Image tag. What was asked for.
- Type:
string - Default:
"18.7-standard-trixie"
import
Section titled “import”Copy databases from another PostgreSQL server when the Cluster is
created (bootstrap.initdb.import). CloudNativePG runs pg_dump
against the source and pg_restore into the new primary, once,
before the instance starts. Writes to the source after that are not
copied, so stop them before the first deploy. The source can run an
older major version. Requires the importSource and importPassword
dependencies when non-null.
- Type:
null or (submodule) - Default:
null
import.databases
Section titled “import.databases”Databases to copy from the source. microservice takes exactly one; monolith also takes * for every database.
-
Type:
non-empty (list of non-empty string) -
Example:
1[2"registry"3]
import.extraSpec
Section titled “import.extraSpec”Merged over bootstrap.initdb.import. Refused: type, databases, roles, and source. CloudNativePG runs postImportApplicationSQL after a microservice import only, so it is refused on a monolith import.
-
Type:
attribute set of anything -
Default:
{ } -
Example:
1{2pgDumpExtraOptions = [3"--jobs=2"4];5postImportApplicationSQL = [6"ANALYZE"7];8}
import.passwordKey
Section titled “import.passwordKey”Key of the importPassword Secret that holds the password of user.
- Type:
non-empty string - Default:
"password"
import.roles
Section titled “import.roles”Roles to copy, with monolith only. * copies every role.
- Type:
list of non-empty string - Default:
[ ]
import.sourceDatabase
Section titled “import.sourceDatabase”Database the import first connects to on the source (connectionParameters.dbname).
- Type:
non-empty string - Default:
"postgres"
import.sslMode
Section titled “import.sslMode”libpq sslmode for the connection to the source. verify-ca
and verify-full check the source’s certificate against the
importCa dependency, so they need one. require encrypts
the connection without checking whose certificate it is.
- Type:
one of "disable", "allow", "prefer", "require", "verify-ca", "verify-full" - Default:
"verify-full"
import.type
Section titled “import.type”microservice copies one database into the application
database (bootstrap.initdb.database, owned by
bootstrap.initdb.owner) and no roles. monolith copies the
listed databases and roles and keeps their owners.
- Type:
one of "microservice", "monolith" - Default:
"microservice"
import.user
Section titled “import.user”Role the import connects as. It must be able to read every object in the databases, and with monolith, the roles.
- Type:
non-empty string - Example:
"postgres"
instances
Section titled “instances”PostgreSQL instances (spec.instances): one primary, the rest streaming replicas the operator fails over to.
- Type:
positive integer, meaning >0 - Default:
kix.availability.pick availability { none = 1; pod = 2; node = 2; zone = 2; }
metrics.enabled
Section titled “metrics.enabled”Enable metrics endpoint and monitoring resources (ServiceMonitor, PrometheusRules) when prometheus is available.
- Type:
boolean - Default:
true
metrics.interval
Section titled “metrics.interval”Scrape interval (e.g. ”30s”). Null = use Prometheus default.
- Type:
null or string - Default:
null
metrics.maxBackupAge
Section titled “metrics.maxBackupAge”Maximum age of the last completed base backup before CNPGBackupMissing fires, as a Prometheus duration. Null derives it from backup.schedule via kix.schedules.staleAfter (two periods plus two hours). Must be set explicitly when backup.schedule has no derivable period.
- Type:
null or string matching the pattern ([0-9]+(ms|s|m|h|d|w|y))+ - Default:
null - Example:
"15d"
metrics.maxReplicationLag
Section titled “metrics.maxReplicationLag”Maximum replay lag before CNPGReplicationLagHigh fires, as a Prometheus duration.
- Type:
string matching the pattern ([0-9]+(ms|s|m|h|d|w|y))+ - Default:
"5m" - Example:
"30s"
resources
Section titled “resources”Container resource requests and limits. Each field keeps its default until set, and null removes a default.
-
Type:
submodule -
Default:
1{2limits = {3cpu = "1";4memory = "2Gi";5};6requests = {7cpu = "1";8memory = "2Gi";9};10}
resources.claims
Section titled “resources.claims”Dynamic resource claims the container uses. Null leaves it unset.
- Type:
null or (list of (submodule)) - Default:
null
resources.claims.*.name
Section titled “resources.claims.*.name”Name of an entry in the pod’s resourceClaims.
- Type:
string
resources.claims.*.request
Section titled “resources.claims.*.request”Request within the claim to use. Null uses the whole claim.
- Type:
null or string - Default:
null
resources.limits
Section titled “resources.limits”Resource quantities by name.
- Type:
open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
{ }
resources.limits.cpu
Section titled “resources.limits.cpu”The cpu quantity. Null leaves it unset.
- Type:
null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"1"
resources.limits.ephemeral-storage
Section titled “resources.limits.ephemeral-storage”The ephemeral-storage quantity. Null leaves it unset.
- Type:
null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
null
resources.limits.memory
Section titled “resources.limits.memory”The memory quantity. Null leaves it unset.
- Type:
null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"2Gi"
resources.requests
Section titled “resources.requests”Resource quantities by name.
- Type:
open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
{ }
resources.requests.cpu
Section titled “resources.requests.cpu”The cpu quantity. Null leaves it unset.
- Type:
null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"1"
resources.requests.ephemeral-storage
Section titled “resources.requests.ephemeral-storage”The ephemeral-storage quantity. Null leaves it unset.
- Type:
null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
null
resources.requests.memory
Section titled “resources.requests.memory”The memory quantity. Null leaves it unset.
- Type:
null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"2Gi"
storage.size
Section titled “storage.size”Size of each instance’s data volume (spec.storage.size).
- Type:
Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"20Gi"
storage.storageClass
Section titled “storage.storageClass”StorageClass of the data volumes. Null takes the storageClasses dependency’s class, or the cluster’s default class without one.
- Type:
null or non-empty string - Default:
null