Scaling down and scaling back up EDB Postgres
Learn how to scale down and scale back up EDB Postgres.
Complete this task when node restarts are anticipated, such as during periods of reduced system stability when manually shutting down nodes or during Red Hat® OpenShift® Container Platform upgrades.
EDB Postgres 1.18.3 or later
- Select your operand
namespace:
oc project <operandNamespace>
- (Optional) Scale down the inventory service to avoid needless
restarts.
oc scale deployment <instanceNameNOI>-topology-inventory --replicas=0 oc scale deployment <instanceNameNOI>-usercfg --replicas=0
- To determine the cluster name of your EDB Postgres cluster, run the following
command.
oc get cluster | grep "noi-postgres-cluster"
- Put the EDB Postgres cluster in
hibernation.
oc annotate cluster <cluster-name> --overwrite k8s.enterprisedb.io/hibernation=on
- Verify that the cluster is in
hibernation.
Example output:oc get cluster <cluster-name> -o "jsonpath={.status.conditions[?(.type==\"k8s.enterprisedb.io/hibernation\")]}"
{"lastTransitionTime":"2024-01-30T14:33:29Z","message":"Cluster has been hibernated","reason":"Hibernated","status":"True","type":"[k8s.enterprisedb.io/hibernation](http://k8s.enterprisedb.io/hibernation)"}
- Wake the EDB Postgres cluster from hibernation when you are
ready.
oc annotate cluster <cluster-name> --overwrite k8s.enterprisedb.io/hibernation=off
- (Optional) If you scaled them down previously in step 2, scale the inventory and usercfg services back
up.
oc scale deployment <instanceNameNOI>-usercfg --replicas=1 oc scale deployment <instanceNameNOI>-topology-inventory --replicas=1
EDB Postgres 1.18.2 or earlier
- Download and install the EDB kubectl
plug-in.
For more information about other installation methods, see Installsudo curl -sSfL https://github.com/EnterpriseDB/kubectl-cnp/raw/main/install.sh | sudo sh -s -- -b /usr/local/bin
in the EDB documentation.
- Select your operand
namespace:
oc project <operandNamespace>
- (Optional) Scale down the inventory service to avoid needless
restarts.
oc scale deployment <instanceNameNOI>-topology-inventory --replicas=0 oc scale deployment <instanceNameNOI>-usercfg --replicas=0
- To determine the cluster name of your EDB Postgres cluster, run the following
command.
oc get cluster | grep "postgres-cluster"
- Put the EDB Postgres cluster in hibernation.
This step might take some time to complete.oc cnp hibernate on <cluster-name>
- Delete the derived noi postgres
secrets.
oc delete secret <instanceNameNOI>-usercfg-postgres-data <instanceNameNOI>-usercfg-postgres-admin <instanceNameNOI>-topology-postgres-admin <instanceNameNOI>-topology-postgres-user <instanceNameNOI>-postgres-ca <instanceNameNOI>-edb-secret
- Wake the EDB Postgres cluster from hibernation when you are ready.
This step might take some time to complete.oc cnp hibernate off <cluster-name>
- (Optional) If you scaled them down previously in step 2, scale the inventory and usercfg services back
up.
oc scale deployment <instanceNameNOI>-usercfg --replicas=1 oc scale deployment <instanceNameNOI>-topology-inventory --replicas=1
- Locate and restart the
noi-operator
pod.oc get pods -A | grep "noi-operator" oc delete pod -n <namespace> <noi-operator-pod-name>