CloudNative Postgres

CloudNative Postgres uses an Operator to watch for new database cluster- and backup- definitions as provided by CRDs.

Operator

The operator is deployed via helm release

Cluster & Backups

S3-compatible storage can be used as a live WAL backup. CNPG now uses a plugin system.

Restore

k8s-at-home discussion

On versioning: If you end up with an older cloudnative pg backup (i.e. i have a pg14 one) but you’re using a newer operator that defaults to newer (i.e. > 15.1), you wont be able to restore as it will whine about versions. Add an image tag to the cluster spec to deploy a second cluster with a specifically downgraded ver to restore without having to juggle around changing the operator helm etc

CLI

Install the kubectl plugin

Updating postgres versions with CNPG

  1. Scale down apps using old cluster
  2. Ensure old cluster is running
  3. Spin up new cluster, pointing .connectionParameters to the old cluster
  4. Ensure new cluster has a scheduledBackup pointing to it
  5. Redirect ext-postgres-operator to new cluster (edit the cluster fqdn in the secret)
  6. Redirect apps to new cluster
  7. Remove the old cluster (remove before scaling up to make sure apps fully switch over)
  8. Scale up apps 🀞🏼

Refs: