// Module included in the following assemblies:
//
// * virt/install/uninstalling-virt.adoc

[id="virt-deleting-virt-cli_{context}"]
= Deleting {VirtProductName}

You can delete {VirtProductName} by using the CLI.

.Prerequisites

- Install the OpenShift CLI (`oc`).

- Access to a {VirtProductName} cluster using an account with
`cluster-admin` permissions.

[NOTE]
====
When you delete the subscription of the {VirtProductName} operator in the OLM by using the CLI, the `ClusterServiceVersion` (CSV) object is not deleted from the cluster. To completely uninstall {VirtProductName}, you must explicitly delete the CSV.
====

.Procedure

. Delete the `HyperConverged` custom resource:
+
[source,terminal]
----
$ oc delete HyperConverged kubevirt-hyperconverged -n openshift-cnv
----

. Delete the subscription of the {VirtProductName} operator in the Operator Lifecycle Manager (OLM):
+
[source,terminal]
----
$ oc delete subscription kubevirt-hyperconverged -n openshift-cnv
----

. Set the cluster service version (CSV) name for {VirtProductName} as an environment variable:
+
[source,terminal]
----
$ CSV_NAME=$(oc get csv -n openshift-cnv -o=custom-columns=:metadata.name)
----
. Delete the CSV from the {VirtProductName} cluster by specifying the CSV name from the previous step:
+
[source,terminal]
----
$ oc delete csv ${CSV_NAME} -n openshift-cnv
----
+
{VirtProductName} is uninstalled when a confirmation message indicates that the CSV was deleted successfully:
+
.Example output
[source,terminal,subs="attributes+"]
----
clusterserviceversion.operators.coreos.com "kubevirt-hyperconverged-operator.v{HCOVersion}" deleted
----
