Uninstalling OKD Virtualization using the CLI

You can uninstall OKD Virtualization by using the OKD CLI.

Prerequisites

Deleting OKD Virtualization

You can delete OKD Virtualization by using the CLI.

Prerequisites

  • Install the OpenShift CLI (oc).

  • Access to a OKD Virtualization cluster using an account with cluster-admin permissions.

When you delete the subscription of the OKD Virtualization operator in the OLM by using the CLI, the ClusterServiceVersion (CSV) object is not deleted from the cluster. To completely uninstall OKD Virtualization, you must explicitly delete the CSV.

Procedure

  1. Delete the HyperConverged custom resource:

    1. $ oc delete HyperConverged kubevirt-hyperconverged -n openshift-cnv
  2. Delete the subscription of the OKD Virtualization operator in the Operator Lifecycle Manager (OLM):

    1. $ oc delete subscription kubevirt-hyperconverged -n openshift-cnv
  3. Set the cluster service version (CSV) name for OKD Virtualization as an environment variable:

    1. $ CSV_NAME=$(oc get csv -n openshift-cnv -o=custom-columns=:metadata.name)
  4. Delete the CSV from the OKD Virtualization cluster by specifying the CSV name from the previous step:

    1. $ oc delete csv ${CSV_NAME} -n openshift-cnv

    OKD Virtualization is uninstalled when a confirmation message indicates that the CSV was deleted successfully:

    Example output

    1. clusterserviceversion.operators.coreos.com "kubevirt-hyperconverged-operator.v4.11.0" deleted