OpenEBS VolumeSnapshots for Cloning Crunchy Data PostgreSQL Clusters
Overview#
Crunchy Postgres for Kubernetes (PGO) provides a robust Kubernetes-native operator for deploying and managing PostgreSQL clusters. In production environments, cloning PostgreSQL clusters is commonly required for development, testing, reporting, and disaster recovery use cases.
OpenEBS Replicated PV Mayastor enables fast, storage-level snapshot capabilities using copy-on-write (COW) semantics. By integrating OpenEBS VolumeSnapshots with Crunchy Postgres for Kubernetes, PostgreSQL clusters can be cloned efficiently without relying solely on traditional logical restore workflows.
Crunchy Postgres for Kubernetes integrates snapshot capture with traditional pgBackRest backup procedures. Each manual or scheduled backup operation produces a consistent snapshot. With each new snapshot, the previous snapshot is automatically deleted, eliminating the need for manual snapshot management.
This document explains how to configure OpenEBS VolumeSnapshots and clone a Crunchy Data PostgreSQL cluster using snapshot-based restoration.
Environment#
The following versions were used for this workflow:
| Component | Version |
|---|---|
| Crunchy PostgreSQL Operator | v5.7 |
| OpenEBS | v4.2.0 |
| Kubernetes | v1.29.6 |
| kubectl mayastor plugin | v2.7.4+0 |
Prerequisites#
Setup OpenEBS#
Install OpenEBS
Ensure that OpenEBS is installed in your cluster. Refer to the OpenEBS Installation Documentation for step-by-step instructions.
Install the
kubectl-openebsPluginEnsure that
kubectl-openebsplugin is installed. Refer to the Kubectl OpenEBS Plugin Documentation to install the plugin.Create a StorageClass
- Create a file named
StorageClass.yaml.
StorageClass.yaml
- Apply the configuration.
Create a VolumeSnapshotClass#
- Create a file named
VolumeSnapshotClass.yaml.
- Apply the configuration.
Crunchy Postgres for Kubernetes (PGO) Setup#
- Install the Operator using Kustomize. Clone the operator examples repository:
Refer to the Install Crunchy Postgres for Kubernetes Documentation for alternative installation methods.
- Create the operator namespace.
- Edit the default kustomization file to enable VolumeSnapshots.
- Add the following environment variable.
- Install the operator.
Deploying a PostgreSQL Cluster#
- Create a namespace for PostgreSQL cluster.
- Create a file named
PostgreSQL_Cluster.yaml.
Cluster.yaml
- Apply the cluster configuration.
Sample Output
After deployment, a backup job runs automatically, generating a consistent snapshot.
- Check if a volumesnapshot was created successfully.
Sample Output
Insert Sample Data into the PostgreSQL Cluster#
- Identify the primary pod.
- Connect to the pod.
- Insert sample data.
Record Count Before Backup

Triggering a Manual Backup#
- Add the manual backup specification to the PostgresCluster CR.
- Trigger the backup using annotation.
For subsequent backups:
Upon successful completion:
- A new snapshot is created
- The previous snapshot is automatically removed
- Check if a volumesnapshot was created successfully.
Sample Output
Cloning the PostgreSQL Cluster#
Crunchy Postgres for Kubernetes will automatically look for the source cluster’s snapshot. If a snapshot is found, a new persistent volume will be populated with the data in the snapshot.
- Create a file named
cluster_clone.yaml.
- Apply the cloned cluster configuration.
The cloned cluster is created in the same namespace as the source cluster.
Verifying Cloned Data#
- Connect to the restored PostgreSQL cluster.
- Verify the data.
Sample Output
The record count should match the source cluster, confirming successful cloning using OpenEBS VolumeSnapshots.
See Also#
- Replicated PV Mayastor Installation on OpenShift
- Replicated PV Mayastor Installation on Talos
- Kasten Backup and Restore using Replicated PV Mayastor Snapshots - FileSystem
- Velero Backup and Restore using Replicated PV Mayastor Snapshots - FileSystem
- KubeVirt VM Backup and Restore using Replicated PV Mayastor VolumeSnapshots and Velero - FileSystem
- OpenEBS VolumeSnapshots for CloudNativePG Backups