Use one of these procedures to delete a virtual machine:

  • Using the web console

  • Using the CLI

Deleting a virtual machine using the web console

Deleting a virtual machine permanently removes it from the cluster.

Delete a virtual machine using the ⋮ button of the virtual machine in the WorkloadsVirtual Machines list, or using the Actions control of the Virtual Machine Details screen.

Procedure
  1. In the Container-native Virtualization console, click WorkloadsVirtual Machines from the side menu.

  2. Click the ⋮ button of the virtual machine to delete and select Delete Virtual Machine.

    • Alternatively, click the virtual machine name to open the Virtual Machine Details screen and click ActionsDelete Virtual Machine.

  3. In the confirmation pop-up window, click Delete to permanently delete the virtual machine.

Deleting a virtual machine and PVCs using the CLI

When you delete a virtual machine, the PVC it uses is unbound.

If you do not plan to bind this PVC to a different VM, it is best practice to delete it, in order to maintain a clean environment and avoid possible confusion.

Procedure

Run these commands to delete the virtual machine and the PVC.

You can delete objects only in the project you are currently working in, unless you specify the -n <project_name> option, for project name.
  1. Run the following command to delete the virtual machine:

    $ oc delete vm <fedora-vm>
  2. Run the following command to delete the PVC associated with the virtual machine.

    $ oc delete pvc <fedora-vm-pvc>