Cannot unbind an OSB service from a Cloud Foundry application

Troubleshooting for unbinding an open service broker (OSB) service from a Cloud Foundry application when the service broker Helm release is deleted from IBM® Cloud Private.

Symptoms

When you are trying to unbind a service in Cloud Foundry by using the cf unbind-service command, you might receive an error similar to the following message:

  root@cfee-5d495b885f-j9xhr:/tmp# cf unbind-service GetStartedJava-04171543 mongodb-04171543
  Unbinding app GetStartedJava-04171543 from service mongodb-04171543 in org org / space dev as admin...
  Unexpected Response
  Response code: 502
  CC code:       0
  CC error code:
  Request ID:    0b02061434afa1b3714bc211f66c7224::89ad36f4-fae1-4834-a58c-6579262b7682
  Description:   {
    "description": "Service instance mongodb-04171543: The service broker could not be reached: http://9.30.194.174:30015/v2/service_instances/1c02bfad-014b-4b95-86dc-791d33b6169c/service_bindings/9ba27173-e909-454c-ab1a-04282bfdd26f?plan_id=3a41389b-739e-496d-87d0-162e95bde385&service_id=d808cc2b-ed0a-41b5-aebc-d2dfd8d72801",
    "error_code": "CF-ServiceBrokerApiUnreachable",
    "code": 10001,
    "http": {
      "uri": "http://9.30.194.174:30015/v2/service_instances/1c02bfad-014b-4b95-86dc-791d33b6169c/service_bindings/9ba27173-e909-454c-ab1a-04282bfdd26f?plan_id=3a41389b-739e-496d-87d0-162e95bde385&service_id=d808cc2b-ed0a-41b5-aebc-d2dfd8d72801",
      "method": "DELETE"
    }
  }

  FAILED

Resolving the problem

The error message usually occurs when the service broker Helm release is deleted from IBM Cloud Private. Use the following steps to recover the environment:

  1. Log in to IBM Cloud Private by using cloudctl. Select the namespace where Cloud Foundry Enterprise Environment is deployed by using the following command:

    cloudctl login -a https://9.30.194.174:8443 --skip-ssl-validation
    
  2. Use the following command to find the POD name where Cloud Foundry Enterprise Environment is deployed:

    kubectl get pods | grep cfee
    
  3. Log in to the pod and replace <POD_NAME> with the POD name you found in Step 2:
    kubectl exec -it <POD_NAME> -- bash
    
  4. Open the Cloud Foundry deployment tool.
  5. Navigate to Menu > 3. States.
  6. Click cfp-ext-osb-installer.
  7. View the logs by clicking the paper icon.
  8. In the logs, find a command similar to the following text:
    helm install /repo_local/ibm-osb-database-chart/1.0.0-009/ibm-osb-database-1.0.0.tgz --name cfee-osb --namespace default  --set brokerconfig.servicebrokersecret=cf-osb-broker-secret,brokerconfig.icpsecret=cf-osb-icp-secret,brokerconfig.externalClusterIp=9.30.194.174,brokerconfig.namespace=default,image=easy-glowworm-cloudfoundry-cluster.icp:8500/default/ibm/servicebroker-cf:1.0.0-009 --tls
    
  9. Run the command that you found in Step 8 in the pod from Step 3.

These steps redeploy the service broker Helm release so that you can successfully unbind an OSB service from a Cloud Foundry application.