-
Notifications
You must be signed in to change notification settings - Fork 15
K8SPG-771 Documented PVC snapshot support #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,368 @@ | ||||||||||||||||||||||||||||||
| # Configure and use PVC snapshots | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| This document provides step-by-step instructions for configuring and using Persistent Volume Claim (PVC) Snapshots with Percona Operator for PostgreSQL on Kubernetes. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| For a high-level explanation of PVC snapshots, please refer to the [PVC snapshot support](backups-pvc-snapshots.md#overview) chapter. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Prerequisites | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| To use PVC snapshots, ensure you have the following prerequisites met: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Your Kubernetes cluster must have a CSI driver that supports Volume Snapshots | ||||||||||||||||||||||||||||||
| For example, Google Kubernetes Engine (GKE) with `pd.csi.storage.gke.io`, or Amazon EKS with `ebs.csi.aws.com`. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 2. Your Kubernetes cluster must have VolumeSnapshot CRDs installed. Most managed Kubernetes providers include these by default. Verify by running: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| kubectl get crd volumesnapshots.snapshot.storage.k8s.io | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 3. At least one `VolumeSnapshotClass` must exist and be compatible with the storage class used by your PostgreSQL data volumes. Check it with: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| kubectl get volumesnapshotclasses | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| If you don't have one, refer to the [Add a VolumeSnapshotClass](#add-volumesnapshotclass) section. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 4. You must enable the `VolumeSnapshots` feature gate for the **Percona Operator for PostgreSQL** deployment. Refer to the [Enable the feature gate](#enable-the-feature-gate) section for details. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Before you start | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Check the [prerequisites](#prerequisites) and [limitations](backups-pvc-snapshots.md#limitations) | ||||||||||||||||||||||||||||||
| 2. Clone the Operator repository to be able to edit manifests: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| git clone -b v{{release}} https://github.com/percona/percona-postgresql-operator | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 2. Export the namespace where you run your cluster as an environment variable: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| export NAMESPACE=<namespace> | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Configuration | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ### Enable the feature gate | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| If you have the Operator Deployment up and running, you can edit the `deploy/operator.yaml` manifest. If you deploy the Operator from scratch, edit the `deploy/bundle.yaml` manifest. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Edit the `deploy/operator.yaml` or `deploy/bundle.yaml` and set the `PGO_FEATURE_GATES` environment variable for the Operator Deployment to `"VolumeSnapshots=true"`: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```yaml | ||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||
| containers: | ||||||||||||||||||||||||||||||
| - name: percona-postgresql-operator | ||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||
| - name: PGO_FEATURE_GATES | ||||||||||||||||||||||||||||||
| value: "VolumeSnapshots=true" | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 2. Apply the configuration: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| kubectl apply -f deploy/operator.yaml -n $NAMESPACE | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| or | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| kubectl apply --sever-side -f deploy/bundle.yaml -n $NAMESPACE | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| kubectl apply --sever-side -f deploy/bundle.yaml -n $NAMESPACE | |
| kubectl apply --server-side -f deploy/bundle.yaml -n $NAMESPACE |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VolumeSnapshotClass YAML example uses a tab-indented name: field under metadata:. Tabs make the YAML invalid for copy/paste; use spaces and align name correctly under metadata:.
| name: gke-snapshot-class | |
| name: gke-snapshot-class |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section documents configuring snapshots under spec.backups.snapshots.volumeSnapshotClassName, but elsewhere in the docs (e.g., docs/operator.md) the fields are backups.volumeSnapshots.className/mode/schedule. Please align the tutorial with the actual CR schema and use consistent key names.
| 2. Edit the `deploy/cr.yaml` Custom Resource and add the `snapshots` subsection under `backups`. Specify the name of the `VolumeSnapshotClass` in the `volumeSnapshotClassName` key: | |
| ```yaml | |
| spec: | |
| backups: | |
| snapshots: | |
| volumeSnapshotClassName: <name-of-your-volume-snapshot-class> | |
| 2. Edit the `deploy/cr.yaml` Custom Resource and add the `volumeSnapshots` subsection under `backups`. Specify the name of the `VolumeSnapshotClass` in the `className` key: | |
| ```yaml | |
| spec: | |
| backups: | |
| volumeSnapshots: | |
| className: <name-of-your-volume-snapshot-class> |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scheduled backup example has an invalid cron expression ("0 3 ** *") and the surrounding text mentions the snapshots subsection while the YAML uses volumeSnapshots. Fix the cron to a valid 5-field expression and make the subsection name consistent.
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Create a new cluster from a PVC snapshot" YAML example has inconsistent indentation and tab characters around dataSource/apiGroup/kind/name, which makes the manifest invalid when copied. Reformat the example using spaces and ensure dataSource is correctly nested under spec (as a sibling of instances).
| dataSource: | |
| apiGroup: snapshot.storage.k8s.io | |
| kind: VolumeSnapshot | |
| name: <name-of-the-pvc-snapshot-backup> | |
| dataSource: | |
| apiGroup: snapshot.storage.k8s.io | |
| kind: VolumeSnapshot | |
| name: <name-of-the-pvc-snapshot-backup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs describe the
spec.methodsupported value asVolumeSnapshot, but the new PVC snapshot tutorial usesmethod: volumeSnapshotand shows the backup TYPE asvolumeSnapshot. Please make the casing consistent across docs to match the actual CRD enum value.