×

To delete (uninstall) an Operator from your cluster, you can simply delete the subscription to remove it from the subscribed namespace. If you want a clean slate, you can also remove the operator CSV and deployment, then delete Operator’s entry in the CatalogSourceConfig. The following text describes how to delete Operators from a cluster using either the web console or the command line.

Deleting Operators from a cluster using the web console

To delete an installed Operator from the selected namespace through the web console, follow these steps:

Procedure
  1. Select the Operator to delete. There are two paths to do this:

    • From the CatalogOperatorHub page:

      1. Scroll or type a keyword into the Filter by keyword box (in this case, jaeger) to find the Operator you want and click on it.

      2. Click Uninstall.

    • From the CatalogOperator Management page:

      1. Select the namespace where the Operator is installed from the Project list. For cluster-wide Operators, the default is openshift-operators.

      2. From the Operator Subscriptions tab, find the Operator you want to delete (in this example, jaeger) and click the Options menu kebab at the end of its entry.

        olm operator delete
      3. Click Remove Subscription.

  2. When prompted by the Remove Subscription window, optionally select the Also completely remove the jaeger Operator from the selected namespace check box if you want all components related to the installation to be removed. This removes the CSV, which in turn removes the Pods, Deployments, CRDs, and CRs associated with the Operator.

  3. Select Remove. This Operator will stop running and no longer receive updates.

Although the Operator is no longer installed or receiving updates, that Operator will still appear on the Operator Catalogs list, ready to re-subscribe. To remove the Operator from that listing, you can delete the Operator’s entry in the CatalogSourceConfig from the command line (as shown in last step of "Deleting operators from a cluster using the CLI").

Deleting Operators from a cluster using the CLI

Instead of using the OpenShift Container Platform web console, you can delete an Operator from your cluster by using the CLI. You do this by deleting the Subscription and ClusterServiceVersion from the targetNamespace, then editing the CatalogSourceConfig to remove the Operator’s package name.

Prerequisites
  • Access to an OpenShift Container Platform cluster using an account with cluster-admin permissions.

  • Install the oc command on your local system.

Procedure

In this example, there are two Operators (Jaeger and Descheduler) installed in the openshift-operators namespace. The goal is to remove Jaeger without removing Descheduler.

  1. Check the current version of the subscribed Operator (for example, jaeger) in the currentCSV field:

    $ oc get subscription jaeger -n openshift-operators -o yaml | grep currentCSV
      currentCSV: jaeger-operator.v1.8.2
  2. Delete the Operator’s Subscription (for example, jaeger):

    $ oc delete subscription jaeger -n openshift-operators
    subscription.operators.coreos.com "jaeger" deleted
  3. Delete the CSV for the Operator in the target namespace using the currentCSV value from the previous step:

    $ oc delete clusterserviceversion jaeger-operator.v1.8.2 -n openshift-operators
    clusterserviceversion.operators.coreos.com "jaeger-operator.v1.8.2" deleted
  4. Display the contents of the CatalogSourceConfig resource and review the list of packages in the spec section:

    $ oc get catalogsourceconfig -n openshift-marketplace \
        installed-community-openshift-operators -o yaml

    For example, the spec section might appear as follows:

    Example of CatalogSourceConfig
    spec:
      csDisplayName: Community Operators
      csPublisher: Community
      packages: jaeger,descheduler
      targetNamespace: openshift-operators
  5. Remove the Operator from the CatalogSourceConfig in one of two ways:

    • If you have multiple Operators, edit the CatalogSourceConfig resource and remove the Operator’s package:

      $ oc edit catalogsourceconfig -n openshift-marketplace \
          installed-community-openshift-operators

      Remove the package from the packages line, as shown:

      Example of modified packages in CatalogSourceConfig
        packages: descheduler

      Save the change and the marketplace-operator will reconcile the CatalogSourceConfig.

    • If there is only one Operator in the CatalogSourceConfig, you can remove it by deleting the entire CatalogSourceConfig as follows:

      $ oc delete catalogsourceconfig -n openshift-marketplace \
          installed-community-openshift-operators