Skip to content
Install the CLI

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.

StabilityStable
package valuepackages.cnpg-cluster
Default aliasespostgres

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.

DependencyRequirement
cnpgOperatorRequired
barmanCloudOptional
cloudIdentityOptional
endpointServiceOptional
importCaOptional
importPasswordOptional
importSourceOptional
prometheusOptional
storageClassesOptional
storageCredentialsOptional

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

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

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

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

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"

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

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:

    {
    configuration = {
    endpointURL = "https://s3.example.com";
    wal = {
    compression = "gzip";
    };
    };
    }

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"

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 * * *"

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"

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:

    {
    postgresql = {
    parameters = {
    max_connections = "200";
    };
    };
    }

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:

    {
    digest = "sha256:37fdeea29a4d3ed14570f719488ba55bd21e8975eaea864be5ce74d25a9a13de";
    pullPolicy = "IfNotPresent";
    repository = "ghcr.io/cloudnative-pg/postgresql";
    tag = "18.7-standard-trixie";
    }

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 tag is the package’s tag, otherwise null

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

Who resolved this pin, for the record. Null when unknown.

  • Type: null or string
  • Default: null

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

  • Type: null or string
  • Default: "IfNotPresent"

Image repository, registry host included.

  • Type: string
  • Default: "ghcr.io/cloudnative-pg/postgresql"

When this pin was resolved, RFC 3339. Null when unknown.

  • Type: null or string
  • Default: null

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. What was asked for.

  • Type: string
  • Default: "18.7-standard-trixie"

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

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:

    [
    "registry"
    ]

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:

    {
    pgDumpExtraOptions = [
    "--jobs=2"
    ];
    postImportApplicationSQL = [
    "ANALYZE"
    ];
    }

Key of the importPassword Secret that holds the password of user.

  • Type: non-empty string
  • Default: "password"

Roles to copy, with monolith only. * copies every role.

  • Type: list of non-empty string
  • Default: [ ]

Database the import first connects to on the source (connectionParameters.dbname).

  • Type: non-empty string
  • Default: "postgres"

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"

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"

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"

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; }

Enable metrics endpoint and monitoring resources (ServiceMonitor, PrometheusRules) when prometheus is available.

  • Type: boolean
  • Default: true

Scrape interval (e.g. ”30s”). Null = use Prometheus default.

  • Type: null or string
  • Default: null

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"

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"

Container resource requests and limits. Each field keeps its default until set, and null removes a default.

  • Type: submodule

  • Default:

    {
    limits = {
    cpu = "1";
    memory = "2Gi";
    };
    requests = {
    cpu = "1";
    memory = "2Gi";
    };
    }

Dynamic resource claims the container uses. Null leaves it unset.

  • Type: null or (list of (submodule))
  • Default: null

Name of an entry in the pod’s resourceClaims.

  • Type: string

Request within the claim to use. Null uses the whole claim.

  • Type: null or string
  • Default: null

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: { }

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"

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

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"

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: { }

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"

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

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"

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"

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