Declarative pausing and resuming v2.0.0
The declarative pausing and resuming feature enables saving CPU power by removing the database pods while keeping the database PVCs.
Declarative pausing and resuming leverages the hibernation functionality available for PG4K. For additional depth and an explanation of how hibernation works, see the Postgres for Kubernetes documentation on declarative hibernation.
Request a pause by adding the k8s.pgd.enterprisedb.io/pause
annotation to the desired PGD group.
For example:
kubectl annotate pgdgroup region-a k8s.pgd.enterprisedb.io/pause=onAfter a few seconds, the requested PGD group will be in a paused state, with all the database pods removed:
kubectl get pgdgroups NAME DATA INSTANCES WITNESS INSTANCES PHASE AGE region-a 2 1 PGDGroup - Paused 25m region-b 2 1 PGDGroup - Healthy 25m region-c 0 1 PGDGroup - Healthy 25m
To resume a paused PGD group, set the annotation to off.
Remember to add the --overwrite flag:
kubectl annotate pgdgroup region-a k8s.pgd.enterprisedb.io/pause=off --overwrite
In a few seconds, you should see the nodes start resuming, and the pods being re-created.
kubectl get pgdgroups NAME DATA INSTANCES WITNESS INSTANCES PHASE AGE region-a 2 1 Pause - resume nodes 1m region-b 2 1 PGDGroup - Healthy 25m region-c 0 1 PGDGroup - Healthy 25m
There are some requirements before the pause annotation can put the PGD group in a paused state. Ideally, the PGD Group should be in a Healthy state. Alternatively, if all the data nodes in the PGD Group are healthy at the individual level, Pause can also be initiated.