Skip to content

Custom Resource options

The Cluster is configured via the deploy/cr.yaml file.

The metadata part of this file contains the following keys:

  • name (cluster1 by default) sets the name of your Percona Distribution for PostgreSQL Cluster; it should include only URL-compatible characters, not exceed 22 characters, start with an alphabetic character, and end with an alphanumeric character;

The spec part of the deploy/cr.yaml file contains the following sections:

Key Value type Default Description
pause boolean false Pause/resume: setting it to true gracefully stops the cluster, and setting it to false after shut down starts the cluster back.
upgradeOptions subdoc Percona Distribution for PostgreSQL upgrade options section
pgPrimary subdoc PostgreSQL Primary instance options section
walStorage subdoc Tablespaces Storage Section
walStorage subdoc Write-ahead Log Storage Section
backup subdoc Section to configure backups and pgBackRest
pmm subdoc Percona Monitoring and Management section
pgBouncer subdoc The pgBouncer connection pooler section
pgReplicas subdoc Section required to manage the replicas within a PostgreSQL cluster
pgBadger subdoc The pgBadger PostgreSQL log analyzer section
Key {{ optionlink(‘database’,’spec’) }}
Value string
Example pgdb
Description The name of a database that the PostgreSQL user can log into after the PostgreSQL cluster is created
Key {{ optionlink(‘disableAutofail’,’spec’) }}
Value boolean
Example false
Description Turns high availability on or off. By default, every cluster can have high availability if there is at least one replica
Key {{ optionlink(‘tlsOnly’,’spec’) }}
Value boolean
Example false
Description Enforece Operator to use only Transport Layer Security (TLS) for both internal and external communications
Key {{ optionlink(‘sslCA’,’spec’) }}
Value string
Example cluster1-ssl-ca
Description The name of the secret with TLS used for both connection encryption (external traffic), and replication (internal traffic)
Key {{ optionlink(‘secretsName’,’spec’) }}
Value string
Example cluster1-secrets
Description The name of the secret created to store credentials for system users
Key {{ optionlink(‘sslSecretName’,’spec’) }}
Value string
Example cluster1-ssl-keypair
Description The name of the secret created to encrypt external communications
Key {{ optionlink(‘sslReplicationSecretName’,’spec’) }}
Value string
Example cluster1-ssl-keypair"
Description The name of the secret created to encrypt internal communications
Key {{ optionlink(‘keepData’,’spec’) }}
Value boolean
Example true
Description If true, PVCs will be kept after the cluster deletion
Key {{ optionlink(‘keepBackups’,’spec’) }}
Value boolean
Example true
Description If true, local backups will be kept after the cluster deletion
Key {{ optionlink(‘pgDataSource.restoreFrom’) }}
Value string
Example ""
Description The name of a data source PostgreSQL cluster, which is used to restore backup to a new cluster
Key {{ optionlink(‘pgDataSource.restoreOpts’) }}
Value string
Example ""
Description Custom pgBackRest options to restore backup to a new cluster

Upgrade Options Section

The upgradeOptions section in the deploy/cr.yaml file contains various configuration options to control Percona Distribution for PostgreSQL upgrades.

Key {{ optionlink(‘upgradeOptions.versionServiceEndpoint’) }}
Value string
Example https://check.percona.com
Description The Version Service URL used to check versions compatibility for upgrade
Key {{ optionlink(‘upgradeOptions.apply’) }}
Value string
Example disabled
Description Specifies how updates are processed by the Operator. Never or Disabled will completely disable automatic upgrades, otherwise it can be set to Latest or Recommended or to a specific version number of Percona Distribution for PostgreSQL to have it version-locked (so that the user can control the version running, but use automatic upgrades to move between them).
Key {{ optionlink(‘upgradeOptions.schedule’) }}
Value string
Example 0 2 \* \* \*
Description Scheduled time to check for updates, specified in the crontab format

pgPrimary Section

The pgPrimary section controls the PostgreSQL Primary instance.

Key {{ optionlink(‘pgPrimary.image’) }}
Value string
Example perconalab/percona-postgresql-operator:main-ppg13-postgres-ha
Description The Docker image of the PostgreSQL Primary instance
Key {{ optionlink(‘pgPrimary.imagePullPolicy’) }}
Value string
Example Always
Description This option is used to set the policy for updating pgPrimary and pgReplicas images
Key {{ optionlink(‘pgPrimary.resources.requests.memory’) }}
Value int
Example 256Mi
Description The Kubernetes memory requests for a PostgreSQL Primary container
Key {{ optionlink(‘pgPrimary.resources.requests.cpu’) }}
Value string
Example 500m
Description Kubernetes CPU requests for a PostgreSQL Primary container
Key {{ optionlink(‘pgPrimary.resources.limits.cpu’) }}
Value string
Example 500m
Description Kubernetes CPU limits for a PostgreSQL Primary container
Key {{ optionlink(‘pgPrimary.resources.limits.memory’) }}
Value string
Example 256Mi
Description The Kubernetes memory limits for a PostgreSQL Primary container
Key {{ optionlink(‘pgPrimary.affinity.antiAffinityType’) }}
Value string
Example preferred
Description Pod anti-affinity type, can be either preferred or required
Key {{ optionlink(‘pgPrimary.affinity.nodeAffinityType’) }}
Value string
Example preferred
Description Node affinity type, can be either preferred or required
Key {{ optionlink(‘pgPrimary.affinity.nodeLabel’) }}
Value label
Example kubernetes.io/region: us-central1
Description Set labels for PostgreSQL instances Node affinity
Key {{ optionlink(‘pgPrimary.affinity.advanced’) }}
Value subdoc
Example
Description Allows using standard Kubernetes affinity constraints for advanced affinity and anti-affinity tuning
Key {{ optionlink(‘pgPrimary.volumeSpec.size’) }}
Value int
Example 1G
Description The Kubernetes PersistentVolumeClaim size for the PostgreSQL Primary storage
Key {{ optionlink(‘pgPrimary.tolerations’) }}
Value subdoc
Example node.alpha.kubernetes.io/unreachable
Description Kubernetes Pod tolerations
Key {{ optionlink(‘pgPrimary.volumeSpec.size’) }}
Value int
Example 1G
Description The Kubernetes PersistentVolumeClaim size for the PostgreSQL Primary storage
Key {{ optionlink(‘pgPrimary.volumeSpec.accessmode’) }}
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Primary storage
Key {{ optionlink(‘pgPrimary.volumeSpec.storagetype’) }}
Value string
Example dynamic
Description Type of the PostgreSQL Primary storage provisioning: create (the default variant; used if storage is provisioned, e.g. using hostpath) or dynamic (for a dynamic storage provisioner, e.g. via a StorageClass)
Key {{ optionlink(‘pgPrimary.volumeSpec.storageclass’) }}
Value string
Example ""
Description Optionally sets the Kubernetes storage class to use with the PostgreSQL Primary storage PersistentVolumeClaim
Key {{ optionlink(‘pgPrimary.volumeSpec.matchLabels’) }}
Value string
Example ""
Description A PostgreSQL Primary storage label selector
Key {{ optionlink(‘pgPrimary.imagePullPolicy’) }}
Value string
Example Always
Description This option is used to set the policy for updating pgPrimary and pgReplicas images
Key {{ optionlink(‘pgPrimary.expose.serviceType’) }}
Value string
Example ClusterIP
Description Specifies the type of Kubernetes Service for pgPrimary
Key {{ optionlink(‘pgPrimary.expose.loadBalancerIP’) }}
Value string
Example 127.0.0.1
Description The static IP-address for the load balancer
Key {{ optionlink(‘pgPrimary.expose.loadBalancerSourceRanges’) }}
Value string
Example "10.0.0.0/8"
Description The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations)
Key {{ optionlink(‘pgPrimary.expose.annotations’) }}
Value label
Example pg-cluster-annot: cluster1
Description The Kubernetes annotations metadata for pgPrimary
Key {{ optionlink(‘pgPrimary.expose.labels’) }}
Value label
Example pg-cluster-label: cluster1
Description Set labels for the pgPrimary Service
Key {{ optionlink(‘pgPrimary.customconfig’) }}
Value string
Example ""
Description Name of the Custom configuration options ConfigMap for PostgreSQL cluster

Tablespaces Storage Section

The tablespaceStorages section in the deploy/cr.yaml file contains configuration options for PostgreSQL Tablespace.

Key {{ optionlink(‘tablespaceStorages.<storage-name>.volumeSpec.size’) }}
Value int
Example 1G
Description The Kubernetes PersistentVolumeClaim size for the PostgreSQL Tablespaces storage
Key {{ optionlink(‘tablespaceStorages.<storage-name>.volumeSpec.accessmode’) }}
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Tablespaces storage
Key {{ optionlink(‘tablespaceStorages.<storage-name>.volumeSpec.storagetype’) }}
Value string
Example dynamic
Description Type of the PostgreSQL Tablespaces storage provisioning: create (the default variant; used if storage is provisioned, e.g. using hostpath) or dynamic (for a dynamic storage provisioner, e.g. via a StorageClass)
Key {{ optionlink(‘tablespaceStorages.<storage-name>.volumeSpec.storageclass’) }}
Value string
Example ""
Description Optionally sets the Kubernetes storage class to use with the PostgreSQL Tablespaces storage PersistentVolumeClaim
Key {{ optionlink(‘tablespaceStorages.<storage-name>.volumeSpec.matchLabels’) }}
Value string
Example ""
Description A PostgreSQL Tablespaces storage label selector

Write-ahead Log Storage Section

The walStorage section in the deploy/cr.yaml file contains configuration options for PostgreSQL write-ahead logging.

Key {{ optionlink(‘walStorage.volumeSpec.size’) }}
Value int
Example 1G
Description The Kubernetes PersistentVolumeClaim size for the PostgreSQL Write-ahead Log storage
Key {{ optionlink(‘walStorage.volumeSpec.accessmode’) }}
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Write-ahead Log storage
Key {{ optionlink(‘walStorage.volumeSpec.storagetype’) }}
Value string
Example dynamic
Description Type of the PostgreSQL Write-ahead Log storage provisioning: create (the default variant; used if storage is provisioned, e.g. using hostpath) or dynamic (for a dynamic storage provisioner, e.g. via a StorageClass)
Key {{ optionlink(‘walStorage.volumeSpec.storageclass’) }}
Value string
Example ""
Description Optionally sets the Kubernetes storage class to use with the PostgreSQL Write-ahead Log storage PersistentVolumeClaim
Key {{ optionlink(‘walStorage.volumeSpec.matchLabels’) }}
Value string
Example ""
Description A PostgreSQL Write-ahead Log storage label selector

Backup Section

The backup section in the deploy/cr.yaml file contains the following configuration options for the regular Percona Distribution for PostgreSQL backups.

Key {{ optionlink(‘backup.image’) }}
Value string
Example perconalab/percona-postgresql-operator:main-ppg13-pgbackrest
Description The Docker image for pgBackRest
Key {{ optionlink(‘backup.backrestRepoImage’) }}
Value string
Example perconalab/percona-postgresql-operator:main-ppg13-pgbackrest-repo
Description The Docker image for the BackRest repository
Key {{ optionlink(‘backup.resources.requests.cpu’) }}
Value string
Example 500m
Description Kubernetes CPU requests for a pgBackRest container
Key {{ optionlink(‘backup.resources.requests.memory’) }}
Value int
Example 48Mi
Description The Kubernetes memory requests for a pgBackRest container
Key {{ optionlink(‘backup.resources.limits.cpu’) }}
Value int
Example 1
Description Kubernetes CPU limits for a pgBackRest container
Key {{ optionlink(‘backup.resources.limits.memory’) }}
Value int
Example 64Mi
Description The Kubernetes memory limits for a pgBackRest container
Key {{ optionlink(‘backup.affinity.antiAffinityType’) }}
Value string
Example preferred
Description Pod anti-affinity type, can be either preferred or required
Key {{ optionlink(‘backup.volumeSpec.size’) }}
Value int
Example 1G
Description The Kubernetes PersistentVolumeClaim size for the pgBackRest Storage
Key {{ optionlink(‘backup.volumeSpec.accessmode’) }}
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the pgBackRest Storage
Key {{ optionlink(‘backup.volumeSpec.storagetype’) }}
Value string
Example dynamic
Description Type of the pgBackRest storage provisioning: create (the default variant; used if storage is provisioned, e.g. using hostpath) or dynamic (for a dynamic storage provisioner, e.g. via a StorageClass)
Key {{ optionlink(‘backup.volumeSpec.storageclass’) }}
Value string
Example ""
Description Optionally sets the Kubernetes storage class to use with the pgBackRest Storage PersistentVolumeClaim
Key {{ optionlink(‘backup.volumeSpec.matchLabels’) }}
Value string
Example ""
Description A pgBackRest storage label selector
Key {{ optionlink(‘backup.storages.<storage-name>.type’) }}
Value string
Example s3
Description Type of the storage used for backups
Key {{ optionlink(‘backup.storages.<storage-name>.endpointURL’) }}
Value string
Example minio-gateway-svc:9000
Description The endpoint URL of the S3-compatible storage to be used for backups (not needed for the original Amazon S3 cloud)
Key {{ optionlink(‘backup.storages.<storage-name>.bucket’) }}
Value string
Example ""
Description The Amazon S3 bucket or Google Cloud Storage bucket
name used for backups
Key {{ optionlink(‘backup.storages.<storage-name>.region’) }}
Value boolean
Example us-east-1
Description The AWS region to use for Amazon and all S3-compatible storages
Key {{ optionlink(‘backup.storages.<storage-name>.uriStyle’) }}
Value string
Example path
Description Optional parameter that specifies if pgBackRest should use the path or host S3 URI style
Key {{ optionlink(‘backup.storages.<storage-name>.verifyTLS’) }}
Value boolean
Example false
Description Enables or disables TLS verification for pgBackRest
Key {{ optionlink(‘backup.storageTypes’) }}
Value array
Example [ "s3" ]
Description The backup storage types for the pgBackRest repository
Key {{ optionlink(‘backup.repoPath’) }}
Value string
Example ""
Description Custom path for pgBackRest repository backups
Key {{ optionlink(‘backup.schedule.name’) }}
Value string
Example sat-night-backup
Description The backup name
Key {{ optionlink(‘backup.schedule.schedule’) }}
Value string
Example 0 0 \* \* 6
Description Scheduled time to make a backup specified in the
crontab format
Key {{ optionlink(‘backup.schedule.keep’) }}
Value int
Example 3
Description The amount of most recent backups to store. Older backups are automatically deleted. Set keep to zero or completely remove it to disable automatic deletion of backups
Key {{ optionlink(‘backup.schedule.type’) }}
Value string
Example full
Description The type of the pgBackRest backup
Key {{ optionlink(‘backup.schedule.storage’) }}
Value string
Example local
Description The type of the pgBackRest repository
Key {{ optionlink(‘backup.schedule.backrestOpts’) }}
Value string
Example --annotation=source=scheduled-backup
Description Custom pgBackRest configuration options for scheduled backups
Key {{ optionlink(‘backup.customconfig’) }}
Value string
Example ""
Description Name of the ConfigMap to pass custom pgBackRest configuration options
Key {{ optionlink(‘backup.imagePullPolicy’) }}
Value string
Example Always
Description This option is used to set the policy for updating pgBackRest images

PMM Section

The pmm section in the deploy/cr.yaml file contains configuration options for Percona Monitoring and Management.

Key {{ optionlink(‘pmm.enabled’) }}
Value boolean
Example false
Description Enables or disables monitoring Percona Distribution for PostgreSQL cluster with PMM
Key {{ optionlink(‘pmm.image’) }}
Value string
Example percona/pmm-client:{{ pmm2recommended }}
Description Percona Monitoring and Management (PMM) Client Docker image
Key {{ optionlink(‘pmm.serverHost’) }}
Value string
Example monitoring-service
Description Address of the PMM Server to collect data from the cluster
Key {{ optionlink(‘pmm.serverUser’) }}
Value string
Example admin
Description The PMM Server User. The PMM Server password should be configured using Secrets
Key {{ optionlink(‘pmm.pmmSecret’) }}
Value string
Example cluster1-pmm-secret
Description Name of the Kubernetes Secret object for the PMM Server password
Key {{ optionlink(‘pmm.resources.requests.memory’) }}
Value string
Example 200M
Description The Kubernetes memory requests for a PMM container
Key {{ optionlink(‘pmm.resources.requests.cpu’) }}
Value string
Example 500m
Description Kubernetes CPU requests for a PMM container
Key {{ optionlink(‘pmm.resources.limits.cpu’) }}
Value string
Example 500m
Description Kubernetes CPU limits for a PMM container
Key {{ optionlink(‘pmm.resources.limits.memory’) }}
Value string
Example 200M
Description The Kubernetes memory limits for a PMM container
Key {{ optionlink(‘pmm.imagePullPolicy’) }}
Value string
Example Always
Description This option is used to set the policy for updating PMM Client images

pgBouncer Section

The pgBouncer section in the deploy/cr.yaml file contains configuration options for the pgBouncer connection pooler for PostgreSQL.

Key {{ optionlink(‘pgBouncer.image’) }}
Value string
Example perconalab/percona-postgresql-operator:main-ppg13-pgbouncer
Description Docker image for the pgBouncer connection pooler
Key {{ optionlink(‘pgBouncer.exposePostgresUser’) }}
Value boolean
Example false
Description Enables or disables exposing postgres user through pgBouncer
Key {{ optionlink(‘pgBouncer.size’) }}
Value int
Example 1G
Description The number of the pgBouncer Pods to provide connection pooling
Key {{ optionlink(‘pgBouncer.resources.requests.cpu’) }}
Value int
Example 1
Description Kubernetes CPU requests for a pgBouncer container
Key {{ optionlink(‘pgBouncer.resources.requests.memory’) }}
Value int
Example 128Mi
Description The Kubernetes memory requests for a pgBouncer container
Key {{ optionlink(‘pgBouncer.resources.limits.cpu’) }}
Value int
Example 2
Description Kubernetes CPU limits for a pgBouncer container
Key {{ optionlink(‘pgBouncer.resources.limits.memory’) }}
Value int
Example 512Mi
Description The Kubernetes memory limits for a pgBouncer container
Key {{ optionlink(‘pgBouncer.affinity.antiAffinityType’) }}
Value string
Example preferred
Description Pod anti-affinity type, can be either preferred or required
Key {{ optionlink(‘pgBouncer.expose.serviceType’) }}
Value string
Example ClusterIP
Description Specifies the type of Kubernetes Service for pgBouncer
Key {{ optionlink(‘pgBouncer.expose.loadBalancerIP’) }}
Value string
Example 127.0.0.1
Description The static IP-address for the load balancer
Key {{ optionlink(‘pgBouncer.expose.loadBalancerSourceRanges’) }}
Value string
Example "10.0.0.0/8"
Description The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations)
Key {{ optionlink(‘pgBouncer.expose.annotations’) }}
Value label
Example pg-cluster-annot: cluster1
Description The Kubernetes annotations metadata for pgBouncer
Key {{ optionlink(‘pgBouncer.expose.labels’) }}
Value label
Example pg-cluster-label: cluster1
Description Set labels for the pgBouncer Service
Key {{ optionlink(‘pgBouncer.imagePullPolicy’) }}
Value string
Example Always
Description This option is used to set the policy for updating pgBouncer images

pgReplicas Section

The pgReplicas section in the deploy/cr.yaml file stores information required to manage the replicas within a PostgreSQL cluster.

Key {{ optionlink(‘pgReplicas..size’) }}
Value int
Example 1G
Description The number of the PostgreSQL Replica Pods
Key {{ optionlink(‘pgReplicas..resources.requests.cpu’) }}
Value int
Example 500m
Description Kubernetes CPU requests for a PostgreSQL Replica container
Key {{ optionlink(‘pgReplicas..resources.requests.memory’) }}
Value int
Example 256Mi
Description The Kubernetes memory requests for a PostgreSQL Replica container
Key {{ optionlink(‘pgReplicas..resources.limits.cpu’) }}
Value int
Example 500m
Description Kubernetes CPU limits for a PostgreSQL Replica container
Key {{ optionlink(‘pgReplicas..resources.limits.memory’) }}
Value int
Example 256Mi
Description The Kubernetes memory limits
for a PostgreSQL Replica container
Key {{ optionlink(‘pgReplicas..volumeSpec.accessmode’) }}
Value string
Example ReadWriteOnce
Description The Kubernetes PersistentVolumeClaim access modes for the PostgreSQL Replica storage
Key {{ optionlink(‘pgReplicas..volumeSpec.size’) }}
Value int
Example 1G
Description The Kubernetes PersistentVolumeClaim size for the PostgreSQL Replica storage
Key {{ optionlink(‘pgReplicas..volumeSpec.storagetype’) }}
Value string
Example dynamic
Description Type of the PostgreSQL Replica storage provisioning: create (the default variant; used if storage is provisioned, e.g. using hostpath) or dynamic (for a dynamic storage provisioner, e.g. via a StorageClass)
Key {{ optionlink(‘pgReplicas..volumeSpec.storageclass’) }}
Value string
Example standard
Description Optionally sets the Kubernetes storage class to use with the PostgreSQL Replica storage PersistentVolumeClaim
Key {{ optionlink(‘pgReplicas..volumeSpec.matchLabels’) }}
Value string
Example ""
Description A PostgreSQL Replica storage label selector
Key {{ optionlink(‘pgReplicas..labels’) }}
Value label
Example pg-cluster-label: cluster1
Description Set labels for PostgreSQL Replica Pods
Key {{ optionlink(‘pgReplicas..annotations’) }}
Value label
Example pg-cluster-annot: cluster1-1
Description The Kubernetes annotations metadata for PostgreSQL Replica
Key {{ optionlink(‘pgReplicas..expose.serviceType’) }}
Value string
Example ClusterIP
Description Specifies the type of Kubernetes Service for for PostgreSQL Replica
Key {{ optionlink(‘pgReplicas..expose.loadBalancerSourceRanges’) }}
Value string
Example "10.0.0.0/8"
Description The range of client IP addresses from which the load balancer should be reachable (if not set, there is no limitations)
Key {{ optionlink(‘pgReplicas..expose.annotations’) }}
Value label
Example pg-cluster-annot: cluster1
Description The Kubernetes annotations metadata for PostgreSQL Replica
Key {{ optionlink(‘pgReplicas..expose.labels’) }}
Value label
Example pg-cluster-label: cluster1
Description Set labels for the PostgreSQL Replica Service

pgBadger Section

The pgBadger section in the deploy/cr.yaml file contains configuration options for the pgBadger PostgreSQL log analyzer.

Key {{ optionlink(‘pgBadger.enabled’) }}
Value boolean
Example false
Description Enables or disables the pgBadger PostgreSQL log analyzer
Key {{ optionlink(‘pgBadger.image’) }}
Value string
Example perconalab/percona-postgresql-operator:main-ppg13-pgbadger
Description pgBadger PostgreSQL log analyzer Docker image
Key {{ optionlink(‘pgBadger.port’) }}
Value int
Example 10000
Description The port number for pgBadger
Key {{ optionlink(‘pgBadger.imagePullPolicy’) }}
Value string
Example Always
Description This option is used to set the policy for updating pgBadger images

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. Join K8S Squad to benefit from early access to features and “ask me anything” sessions with the Experts.