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/master/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.84.0/examples/postgresql-deploymentconfig/blueprint-v2/postgres-dep-config-blueprint.yaml

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.