Uninstalling Watson Knowledge Studio

An instance administrator can uninstall Watson Knowledge Studio.

Who needs to complete this task?

Instance administrator To uninstall Watson Knowledge Studio, you must be an instance administrator. An instance administrator has permission to manage software in the following projects:

The operators project for the instance

The operators for this instance of Cloud Pak for Data are installed in the operators project. In the uninstall commands, the ${PROJECT_CPD_INST_OPERATORS} environment variable refers to the operators project.

The operands project for the instance

The Cloud Pak for Data control plane and the services for this instance of Cloud Pak for Data are installed in the operands project. In the uninstall commands, the ${PROJECT_CPD_INST_OPERANDS} environment variable refers to the operands project.

When do you need to complete this task?

Complete this task if you want to remove Watson Knowledge Studio from an instance of Cloud Pak for Data.

Repeat as needed If you are responsible for multiple instances of Cloud Pak for Data, you can repeat this task to remove other instances of Watson Knowledge Studio on the cluster.

Information you need to complete this task

Review the following information before you uninstall Watson Knowledge Studio:

Environment variables
The commands in this task use environment variables so that you can run the commands exactly as written.
  • If you don't have the script that defines the environment variables, see Setting up installation environment variables.
  • To use the environment variables from the script, you must source the environment variables before you run the commands in this task. For example, run:
    source ./cpd_vars.sh

Procedure

Complete the following tasks to uninstall Watson Knowledge Studio:

  1. Logging in
  2. Uninstalling the service
  3. Uninstalling the operator
  4. Removing associated resources

Logging in

  1. Run the cpd-cli manage login-to-ocp command to log in to the cluster as a user with sufficient permissions to complete this task. For example:
    cpd-cli manage login-to-ocp \
    --username=${OCP_USERNAME} \
    --password=${OCP_PASSWORD} \
    --server=${OCP_URL}
    Tip: The login-to-ocp command takes the same input as the oc login command. Run oc login --help for details.

Uninstalling the service

To uninstall the service:
  1. Create an environment variable named OPERAND_NAME to store the operand name for Watson Knowledge Studio.
    oc get KnowledgeStudio --namespace ${PROJECT_CPD_INST_OPERANDS}
    export OPERAND_NAME=<operand_name>
  2. Use the following commands to uninstall the service and its associated resources:
    oc delete KnowledgeStudio wks
    oc delete pvc -l 'release in (wks,wks-minio,wks-ibm-watson-ks)'
    oc delete pvc wks-minio-ibm-minio-backup-pvc
    oc delete secret -l 'release in (wks,wks-minio,wks-ibm-watson-ks)'
    

Uninstalling the operator

To uninstall the operator and other Red Hat® OpenShift® Container Platform Operator Lifecycle Manager (OLM) objects:
  1. Delete the OLM objects for Watson Knowledge Studio:
    cpd-cli manage delete-olm-artifacts \
    --cpd_operator_ns=${PROJECT_CPD_INST_OPERATORS} \
    --components=watson_ks
    • If the command succeeds, it returns [SUCCESS]... The delete-olm-artifacts command ran successfully.
    • If the command fails, it returns [ERROR] and includes information about the cause of the failure.

Removing associated resources

Complete these extra steps to clean up after the service is removed:
  1. Remove Watson Knowledge Studio data from Multicloud Object Gateway.
    Important: This procedure deletes the data for all installations of Watson Knowledge Studio in all projects (namespaces) on the cluster. You cannot delete data from Multicloud Object Gateway on a per-project basis. Ensure that all Watson Knowledge Studio projects were uninstalled from the cluster before you complete this procedure.
    1. Download the MinIO client.

      Refer to the MinIO product documentation and follow the appropriate instructions for your platform.

    2. Get the host and port information for the Multicloud Object Gateway and store it in an environment variable named MCG_ENDPOINT by entering the following command:
      export MCG_ENDPOINT="$(oc get route s3 --namespace openshift-storage \
      --output jsonpath='https://{.spec.host}')"
    3. Get the access key and secret key of Multicloud Object Gateway from the noobaa-account-watson-ks secret and store the keys in environment variables.
      export MCG_ACCESS_KEY="$(oc extract secret/noobaa-account-watson-ks \
              --keys=AWS_ACCESS_KEY_ID --to=- --namespace ${PROJECT_CPD_INST_OPERANDS})"
      export MCG_SECRET_KEY="$(oc extract secret/noobaa-account-watson-ks \
              --keys=AWS_SECRET_ACCESS_KEY --to=- --namespace \
          ${PROJECT_CPD_INST_OPERANDS})"
    4. Configure the MinIO client for Multicloud Object Gateway.
      mc alias set wks "${MCG_ENDPOINT}" "${MCG_ACCESS_KEY}" "${MCG_SECRET_KEY}"
      Note: If necessary, follow the instructions in the MinIO documentation to configure a security certificate. Otherwise, specify the --insecure option to disable certificate verification. If you disable verification for the client, you must include the --insecure option when you submit the mc commands.
    5. Run the following command to confirm that the MinIO client is successfully configured. The command lists the buckets that are used by Watson Knowledge Studio.
      mc ls wks
      If an error is displayed, check the variables that you defined in the previous steps and ensure that the Multicloud Object Gateway host and port are accessible from your console.
    6. Delete the following objects and buckets that were created by Watson Knowledge Studio:
      • wks-icp
      To do so, run the following commands:
      mc rm --recursive --force wks/wks-icp
      mc rb wks/wks-icp
    7. Remove the Multicloud Object Gateway configuration from the MinIO client by entering the following command:
      mc alias remove wks
  2. Verify that all secret resources that were created by the service are deleted. Run the following commands to list any remaining resources:
    oc get secret noobaa-account-watson-ks noobaa-cert-watson-ks noobaa-uri-watson-ks
  3. If any resources are listed, delete them by running the following command for each resource one at a time:
    oc delete secret {secret-name}