Status: EXPERIMENTAL
This plugin adds backup and restore functionality to CloudNativePG by leveraging WAL-G. It communicates with CloudNativePG through the cnpg-i interface, enabling seamless integration for managing PostgreSQL backups and restores in Kubernetes environments.
- Full and incremental backups creation
- Continuous WAL archivation/restoration
- Encryption with symmetric key via
libsodium - Encryption with asymmetric key via
GPG(planned)
- Restore to any
wal-g-created backup - Point-in-time Recovery (PITR) supporting timestamp/transaction XID/LSN
- S3-compatible storage support (AWS S3, MinIO)
- Azure (currently not planned, need community support)
- GCS (currently not planned, need community support)
- Retention and auto-removal of outdated backups and WALs
- Marking Backups as persistent (protect from removing from storage, even if
BackuporBackupConfigcustom resource deleted) (planned) - Monitoring (planned)
-
BackupConfigStatus displaying for last recoverability point, last successful backup, storage consumption (planned)
- Kubernetes version 1.11 or higher
- CloudNative PG version 1.25 or higher
- Cert-manager version 1.13 or higher
-
Install latest stable
cloudnative-pgrelease andcert-manager(later is needed to generate certificates for secure communication between CNPG and plugin)# Install CNPG kubectl apply --server-side -f \ https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.26/releases/cnpg-1.26.0.yaml # Install cert-manager kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml
-
Install latest plugin release into
cnpg-systemnamespace (that should be the same namespace wherecloudnative-pginstalled)
- via Helm:
helm -n cnpg-system upgrade --install cnpg-plugin-wal-g oci://ghcr.io/wal-g/cnpg-plugin-wal-g:0.2.1-helm-chart
- or via static manifest
kubectl apply -f https://raw.githubusercontent.com/wal-g/cnpg-plugin-wal-g/v0.2.1/dist/install.yaml
- Adjust sample manifests from
config/samples/new-clusterand applykubectl apply -f ./config/samples/new-cluster
You should encounter new CNPG Cluster with encrypted WAL archivation and periodic auto-backups performed by plugin and WAL-G.
- go version v1.23.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- kind version v0.27.0+ or access to existing K8s v1.11.3+ cluster.
Bootstrap local k8s cluster with kind
./hack/kind/boostrap_kind_with_cnpg.shBuild docker image locally
make docker-buildInstall the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG (using deploy-kind, which injects imagePullPolicy: Never):
make deploy-kind./hack/kind/cleanup_kind.shBuild and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/cnpg-plugin-wal-g:tagNOTE: This image ought to be published in the personal registry you specified. And it is required to have access to pull the image from the working environment. Make sure you have the proper permission to the registry if the above commands don’t work.
Install the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/cnpg-plugin-wal-g:tagNOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin privileges or be logged in as admin.
Create instances of your solution You can apply the samples (examples) from the config/sample:
kubectl apply -f config/samples/new-clusterNOTE: Ensure that the samples has default values to test it out.
Delete the instances (CRs) from the cluster:
kubectl delete -f config/samples/new-clusterDelete the APIs(CRDs) from the cluster:
make uninstallUnDeploy the controller from the cluster:
make undeploy# 1) Choose new tag
export GIT_TAG=v0.2.0
# 2) Make installer file (./dist/install.yaml) with new tag and commit
make build-installer && git add ./dist/install.yaml && git commit -m "Bump installer to version $GIT_TAG" && git push
# 3) Create new tag
git tag -m "Version $GIT_TAG" $GIT_TAG
# 4) Push new tag and commit
git push origin $GIT_TAG
# 5) Unset GIT_TAG variable
unset GIT_TAG