Back up PostgreSQL on Kubernetes
You can use the instructions on this page to create pre and post backup rules with Portworx Backup, which take application-consistent backups for PostgreSQL on Kubernetes in production.
Postgres places data within a data directory known as PGDATA
. The most common location for PGDATA
is /var/lib/pgsql/data
. You must configure your Kubernetes spec file with this volumeMount when using a persistent volume.
PGDATA
contains control, configuration, and data files related to the Postgres server which need to be backed up. Assigning the PGDATA
directory a persistent volume claim allows Portworx Backup to back up and restore Postgres server data.
Postgres suggests taking a CHECKPOINT
to flush data to disk before any snapshots.
Installation
Prerequisites
-
Postgres pods should use the label
app=postgres
for this example. -
If the Postgres username and password are available in the pod as an environment variable, the below actions can be used. If not, you may need to adjust the command.