Uninstalling by running a script

To remove all the deployed capabilities, delete the associated resources and the namespace that you used to install the deployment.

Before you begin

If you need to back up your data, make sure that you take the necessary steps to reinstall the deployment. For example, make a copy of the custom resource (CR) that you used in the environment. Make copies of the security definitions that are used to protect the configuration data in the environment. Make copies of the persistent volumes (PV) and persistent volume claims (PVC) in the environment.
Tip: Make sure that you run the must_gather.py script to collect all information about your deployment. For more information, see topic Must Gather.

The clean_deployment.py script uses the following utility tools and needs them to be installed on your client machine:

  • Kubernetes CLI
  • Python
  • ibm-content-cortex-containers repository from GitHub
To install the specified tools that are used by the clean_deployment.py script, see topic Preparing a client to connect to the cluster.

If the script finds that any of these tools are missing on the client, it reports which tools are missing and provides a choice to install the tool.

About this task

Uninstalling and cleaning up the cluster involves several separate high-level tasks.

  • Uninstalling the Content Cortex deployment.
  • Uninstalling the operators.
  • Deleting PVCs and PVs not containing data.
  • Deleting secrets and configmaps.
Note: The clean_deployment.py script does not delete the CRD and CatalogSource files.

The clean_deployment.py script automates the clean up of the deployment and deletes the operator.

The clean_deployment.py script has two modes.

deployment
When you run the script in deployment mode, it first checks whether all the required utility tools exist and flags files that are missing. When all the required tools exist and the prerequisites validation passes, it lists all the deployment resources for the selected platform and namespace and deletes them after you confirm.
operator
When you run the script in operator mode, it first checks whether all the required utility tools exist and flags files that are missing. The script then deletes the operator for the selected platform and namespace after you confirm.

After you downloaded the ibm-content-cortex-containers repository, change the directory to the ibm-content-cortex-containers/scripts folder.

The script can be run from this location and has the following options:
python3 clean_deployment.py --help

Usage: clean_deployment.py [OPTIONS] COMMAND [ARGS]...

Content Cortex Deployment Cleanup CLI.

Options:
  --version                      Show version and exit. 
  --install-completion           Install completion for the current shell.
  --show-completion              Show completion for the current shell, to copy it or customize the installation.
  --help                         Show this message and exit.

Customization and Utils:
  --silent     --no-silent       Enable Silent Install (no prompts). [default: no-silent]
  --verbose    --no-verbose      Enable verbose logging. [default: no-verbose]
  --dryrun     --no-dryrun       Perform a dry run [default: no-dryrun]

Commands:  
  deployment     Uninstall FNCM Deployment Only.
  operator       Uninstall FNCM Operator only.
You can run the script interactively, or supply a configuration file beforehand and run the script as a silent deployment.
When you run the script in interactive mode, you can specify the mode that you want. When you run the script without specifying a mode, it runs in all modes. The following command runs the script interactively:
python3 clean_deployment.py
Tip: Before you run the script in silent mode, make sure that you fill the ./scripts/silent_config/silent_install_cleandeployment.toml file and then run the following command:
python3 clean_deployment.py --silent

To uninstall the Content Cortex deployment, use the following steps.

Procedure

  1. Open a terminal or command prompt and log in to the target cluster as the <cluster-admin> user.
  2. Go to the directory where the ibm-content-cortex-containers repository was downloaded:
    cd ./ibm-content-cortex-containers/scripts
  3. Run the following command to install the necessary Python packages from the requirements.txt file:
    python3 -m pip install -r requirements.txt
  4. Run the clean_deployment.py script in deployment mode to delete the deployment.
    • Deployment mode (Interactive)
      You can use the following command to run the script in deployment mode interactively:
      python3 clean_deployment.py deployment
      The prerequisites validation for this mode checks whether the required utility tools like Podman or Docker exist and flags them if they are missing. You need to specify the platform and the namespace for which you want to delete your custom resource deployments. The script lists all the deployment resources that would be deleted. When you confirm that you want to delete the deployment, the script deletes the listed deployment resources.
    • Deployment mode (Silent)
      Before you run the script in silent mode, make sure that you fill the ./scripts/silent_config/silent_install_cleandeployment.toml file and then run the following command:
      python3 clean_deployment.py --silent deployment
      The prerequisites validation for this mode checks whether the required utility tools like Podman or Docker exist and flags them if they are missing. After the prerequisites validation passes, the script deletes the deployment resources.
  5. To uninstall the operator, run the clean_deployment.py script in operator mode.
    • Operator mode (Interactive)
      You can use the following command to run the script in operator mode interactively:
      python3 clean_deployment.py operator
      The prerequisites validation for this mode checks whether the required utility tools like Podman or Docker exist and flags them if they are missing. You need to specify the platform and the namespace for which you want to delete the operator. After you confirm whether you want to proceed with the operation, the script then deletes the operator.
    • Operator mode (Silent)
      Before you run the script in silent mode, make sure that you fill the ./scripts/silent_config/silent_install_cleandeployment.toml file and then run the following command:
      python3 clean_deployment.py --silent operator
      The prerequisites validation for this mode checks whether the required utility tools like Podman or Docker exist and flags them if they are missing. After the prerequisites validation passes, the script deletes the operator.
  6. Verify that all the pods that you created with the operator are stopped and deleted.
    Note: Deleting the FNCMCluster and uninstalling the Content Cortex operator does not delete the existing PVs/PVC, or the databases that are used by the various components. Check the persisted data before you delete the PVs/PVCs manually to make sure you no longer want to keep them. Likewise, if the data no longer needs to be retained or reused you can delete the databases.

What to do next

If you plan to clean up the Content Cortex data, see the topic Cleaning up Content Cortex.