Status of Postgres cluster custom resource is stuck in the Setting up primary state or no state

After you install or upgrade to IBM Cloud Pak foundational services version 4.6 or later while using Postgres cluster as a database, the status of common-service-db Postgres cluster custom resource (CR) is stuck in the Setting up primary state or no state.

Symptom

The installation or upgrade process does not complete and you can observe the following symptoms:

Cause

This issue occurs when the cloud-native postgresql operator is running into race condition and cannot create the required resources for the common-service-db Postgres cluster CR.

For more information, see the description of the similar issues in the cloudnative-pg community: 4147 and 5235.

Resolving the problem

Note: Perform the following actions only if the issue occurs when you install or upgrade {{site.data.keyword.cs}} version 4.6 or later. If this issue occurs after installation or upgrade, contact IBM® support.

To resolve the issue, delete the existing common-service-db Postgres cluster CR and re-create it. Complete the following steps.

  1. Delete the common-service-db Postgres Cluster CR.

     oc delete cluster.postgresql.k8s common-service-db -n <namespace-where-foundational services-are-installed>
    
  2. Delete the operand-deployment-lifecycle-manager pod to re-create the common-service-db Postgres cluster (CR).

     oc delete pod -n <namespace-where-foundational services-are-installed> -l name=operand-deployment-lifecycle-manager
    
  3. Make sure that the common-service-db Postgres cluster CR is created successfully.

     oc get cluster.postgresql.k8s common-service-db -n <namespace-where-foundational services-are-installed>
    
  4. Wait for the common-service-db Postgres cluster CR status to change to Cluster in healthy state.

     oc get cluster.postgresql.k8s common-service-db -n <namespace-where-foundational services-are-installed> -o jsonpath='{.status.phase}'
    

    The following output shows the CR in the luster in healthy state status:

     Cluster in healthy state