Scaling down and scaling back up EDB Postgres

Learn how to scale down and scale back up EDB Postgres.

EDB Postgres 1.18.3 or later

  1. Select your operand namespace:
    oc project <operandNamespace>
  2. (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
  3. To determine the cluster name of your EDB Postgres cluster, run the following command.
    oc get cluster | grep "noi-postgres-cluster"
  4. Put the EDB Postgres cluster in hibernation.
    oc annotate cluster <cluster-name> --overwrite k8s.enterprisedb.io/hibernation=on
  5. Verify that the cluster is in hibernation.
    oc get cluster <cluster-name> -o "jsonpath={.status.conditions[?(.type==\"k8s.enterprisedb.io/hibernation\")]}"
    Example output:
    {"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)"}
  6. Wake the EDB Postgres cluster from hibernation when you are ready.
    oc annotate cluster <cluster-name> --overwrite k8s.enterprisedb.io/hibernation=off
  7. (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

  1. Download and install the EDB kubectl plug-in.
    sudo curl -sSfL https://github.com/EnterpriseDB/kubectl-cnp/raw/main/install.sh | sudo sh -s -- -b /usr/local/bin
    For more information about other installation methods, see Install external icon in the EDB documentation.
  2. Select your operand namespace:
    oc project <operandNamespace>
  3. (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
  4. To determine the cluster name of your EDB Postgres cluster, run the following command.
    oc get cluster | grep "postgres-cluster"
  5. Put the EDB Postgres cluster in hibernation.
    oc cnp hibernate on <cluster-name>
    This step might take some time to complete.
  6. 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
  7. Wake the EDB Postgres cluster from hibernation when you are ready.
    oc cnp hibernate off <cluster-name>
    This step might take some time to complete.
  8. (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
  9. Locate and restart the noi-operator pod.
    oc get pods -A | grep "noi-operator"
    oc delete pod -n <namespace> <noi-operator-pod-name>