PGO Logical Backup

PGO uses open source pgBackRest to backup and restore Postgres data. K10 platform integrates with PGO to perform backup and restore Postgres data using the operator APIs.

Steps for installing the PGO and PostgresCluster can be found here.

Enable Manual Backups on PostgresCluster

To allow K10 to perform on-demand backup, manual backups need to be enabled on the PostgresCluster. This can be done by applying the following patch to the PostgresCluster CR

kubectl patch postgrescluster NAME --namespace NAMESPACE --type merge --patch "$(cat << EOM
spec:
  backups:
    pgbackrest:
      manual:
        repoName: <REPO-NAME>
        options:
         - --type=incr
EOM
)"

Where, REPO-NAME is the backup repository configured for PGO. The complete list of supported backup repositories can be found here.

PGO Backup with K10

Once PostgresCluster CR is patched to enable manual backups, a K10 Policy can be created to perform backups of the PGO application.

PGO Restore with K10

PGO restores need to be performed in 2 steps

Restore Operator and Components

The first step is to restore only the operator and related components. This is to make sure that the operator becomes ready before restoring the CR.

  1. Select the Restore Point that needs to be restored.

  2. Deselect all the Volume Snapshots under the Artifacts section of Restore Point details.

  3. From the Spec Artifacts, Deselect all the artifacts of type statefulset and postgrescluster.

  4. Click on Restore to perform the restore operation.

Restore PostgresCluster

The next step is to restore PostgresCluster resources and data. PostgresCluster components are managed by the Postgres operator (PGO). The StatefulSet workloads are created by the operator when a PostgresCluster Custom Resource is created. For this reason, the StatefulSet objects do not need to be restored as they are managed by the operator.

Follow the steps below to restore PostgresCluster without conflicting with the functioning of the operator.

  1. Select the Restore Point again.

  2. Deselect all the artifacts under the Artifacts section.

  3. Now, under Spec Artifacts, select only artifact(s) of type postgresclusters.

  4. Click Restore to perform the restore of PostgresCluster and data.

Known Limitations

K10 uses PGO APIs to perform Backup and Restore of Postgres data. Since PGO uses the pgBackRest tool for managing backups, please take a note of the following limitations:

  • Postgres Operator must be running before performing PostgresCluster restore.

  • PGO does not support an API for deleting the pgBackRest restore point. Due to this reason, K10 cannot delete PostgresCluster restore point as per the K10 Policy's retention configuration. It is recommended to set the correct retention configuration in the PostgresCluster spec. The details about managing PGO backup retention can be found here. Also, note that the PGO repository can be different from the K10 Location Profiles.

  • Restoring to a different namespace is not supported as of now.