Declarative hibernation v1
EDB Postgres for Kubernetes is designed to keep PostgreSQL clusters up, running and available anytime.
There are some kinds of workloads that require the database to be up only when the workload is active. Batch-driven solutions are one such case.
In batch-driven solutions, the database needs to be up only when the batch process is running.
The declarative hibernation feature enables saving CPU power by removing the database Pods, while keeping the database PVCs.
Declarative hibernation is different from the existing implementation
of imperative hibernation via the
Imperative hibernation shuts down all Postgres instances in the High
Availability cluster, and keeps a static copy of the PVCs of the primary that
PGDATA and WALs. The plugin enables to exit the hibernation phase, by
resuming the primary and then recreating all the replicas - if they exist.
To hibernate a cluster, set the
A hibernated cluster won't have any running Pods, while the PVCs are retained so that the cluster can be rehydrated at a later time. Replica PVCs will be kept in addition to the primary's PVC.
The hibernation procedure will delete the primary Pod and then the replica Pods, avoiding switchover, to ensure the replicas are kept in sync.
The hibernation status can be monitored by looking for the
The hibernation status can also be read with the
status sub-command of the
cnp plugin for
To rehydrate a cluster, either set the
k8s.enterprisedb.io/hibernation annotation to
Or, just unset it altogether:
The Pods will be recreated and the cluster will resume operation.