Examples
The examples show configuration files for setting up your PostgreSQL cluster.
Important
These examples are for demonstration and experimentation purposes. You can execute them on a personal Kubernetes cluster with Minikube or Kind, as described in Quick start.
Reference
For a list of available options, see API reference.
Basics
- Basic cluster
cluster-example.yamlA basic example of a cluster.- Custom cluster
cluster-example-custom.yamlA basic cluster that uses the default storage class and custom parameters for thepostgresql.confandpg_hba.conffiles.- Cluster with customized storage class
cluster-storage-class.yaml: A basic cluster that uses a specified storage class ofstandard.- Cluster with persistent volume claim (PVC) template configured
cluster-pvc-template.yaml: A basic cluster with an explicit persistent volume claim template.- Extended configuration example
cluster-example-full.yaml: A cluster that sets most of the available options.- Bootstrap cluster with SQL files
cluster-example-initdb-sql-refs.yaml: A cluster example that executes a set of queries defined in a secret and aConfigMapright after the database is created.- Sample cluster with customized
pg_hbaconfiguration cluster-example-pg-hba.yaml: A basic cluster that enables the user app to authenticate using certificates.- Sample cluster with Secret and ConfigMap mounted using projected volume template
cluster-example-projected-volume.yamlA basic cluster with the existingSecretandConfigMapmounted into Postgres pod using projected volume mount.
Backups
- Customized storage class and backups
- Prerequisites: Bucket storage must be available. The sample config is for AWS. Change it to suit your setup.
cluster-storage-class-with-backup.yamlA cluster with backups configured.- Backup
- Prerequisites:
cluster-storage-class-with-backup.yamlapplied and healthy. backup-example.yaml: An example of a backup that runs against the previous sample.- Simple cluster with backup configured for minio
- Prerequisites: The configuration assumes minio is running and working.
Update
backup.barmanObjectStorewith your minio parameters or your cloud solution. cluster-example-with-backup.yamlA basic cluster with backups configured.- Simple cluster with backup configured for Scaleway Object Storage
- Prerequisites: The configuration assumes a Scaleway Object Storage bucket exists.
Update
backup.barmanObjectStorewith your Scaleway parameters. cluster-example-with-backup-scaleway.yamlA basic cluster with backups configured to work with Scaleway Object Storage..
Replica clusters
- Replica cluster by way of backup from an object store
- Prerequisites:
cluster-storage-class-with-backup.yamlapplied and healthy, and a backupcluster-example-trigger-backup.yamlapplied and completed. cluster-example-replica-from-backup-simple.yaml: A replica cluster following a cluster with backup configured.- Replica cluster by way of volume snapshot
- Prerequisites:
cluster-example-with-volume-snapshot.yamlapplied and healthy, and a volume snapshotbackup-with-volume-snapshot.yamlapplied and completed. cluster-example-replica-from-volume-snapshot.yaml: A replica cluster following a cluster with volume snapshot configured.- Replica cluster by way of streaming (pg_basebackup)
- Prerequisites:
cluster-example.yamlapplied and healthy. cluster-example-replica-streaming.yaml: A replica cluster followingcluster-examplewith streaming replication.
PostGIS
- PostGIS example
postgis-example.yaml: An example of a PostGIS cluster. See PostGIS for details.
Managed roles
- Cluster with declarative role management
cluster-example-with-roles.yaml: Declares a role with themanagedstanza. Includes password management with Kubernetes secrets.
Managed services
- Cluster with managed services
cluster-example-managed-services.yaml: Declares a service with themanagedstanza. Includes default service disabled and newrwservice template ofLoadBalancertype defined.
Declarative tablespaces
- Cluster with declarative tablespaces
cluster-example-with-tablespaces.yaml- Cluster with declarative tablespaces and backup
- Prerequisites: The configuration assumes minio is running and working.
Update
backup.barmanObjectStorewith your minio parameters or your cloud solution. cluster-example-with-tablespaces-backup.yaml- Restored cluster with tablespaces from object store
- Prerequisites: The previous cluster applied and a base backup completed.
Remember to update
bootstrap.recovery.backup.namewith the backup name. cluster-restore-with-tablespaces.yaml
For a list of available options, see API reference.
Pooler configuration
- Pooler with custom service config
pooler-external.yaml