Logical PostgreSQL Backup on OpenShift Clusters
To demonstrate data protection for PostgreSQL provided and deployed with OpenShift, the install should be performed according to the documentation provided here.
$ oc create namespace postgres
$ oc new-app https://raw.githubusercontent.com/openshift/origin/release-4.11/examples/db-templates/postgresql-ephemeral-template.json \
--namespace postgres -e POSTGRESQL_ADMIN_PASSWORD=secretpassword
Note
The secret that gets created after installation of PostgreSQL doesn't have the ADMIN password that we have just specified and this password is used by the Blueprint to connect to the PostgreSQL instance and perform the data management operations.
To address the above issue, a secret should be created that will have this
ADMIN password with the key postgresql_admin_password
.
$ oc create secret generic postgresql-postgres --namespace postgres \
--from-literal=postgresql_admin_password=secretpassword
A Blueprint resource should be created via the following command:
$ oc --namespace kasten-io apply -f \
https://raw.githubusercontent.com/kanisterio/kanister/0.107.0/examples/postgresql-deploymentconfig/blueprint-v2/postgres-dep-config-blueprint.yaml
For PostgreSQL App Versions 14.x or older, Kanister tools version 0.85.0 is required.
$ oc --namespace kasten-io apply -f \
https://raw.githubusercontent.com/kanisterio/kanister/0.85.0/examples/postgresql-deploymentconfig/blueprint-v2/postgres-dep-config-blueprint.yaml
Note
The PostgreSQL backup example provided above serves as a blueprint template for logical backups on OpenShift clusters. Please note that these examples may need to be modified for specific production environments and setups on OpenShift. As a result, it is highly recommended to carefully review and modify the blueprints as needed before deploying them for production use.
Alternatively, use the Blueprints page on K10 Dashboard to create the Blueprint resource.
Once the Blueprint is created, annotate the DeploymentConfig with the below annotations to instruct K10 to use this Blueprint while performing data management operations on the PostgreSQL instance.
$ oc --namespace postgres annotate deploymentconfig/postgresql \
kanister.kasten.io/blueprint=postgres-bp
Finally, use K10 to backup and restore the application.