You can upload a disk image that is stored locally by using the virtctl command-line utility.

Prerequisites
  • Install the kubevirt-virtctl package

Uploading a local disk image to a new PersistentVolumeClaim

You can use the virtctl CLI utility to upload a virtual machine disk image from a client machine to your cluster. Uploading the disk image creates a PersistentVolumeClaim (PVC) that you can associate with a virtual machine.

Prerequisites
  • A virtual machine disk image, in RAW, ISO, or QCOW2 format, optionally compressed by using xz or gz.

  • The kubevirt-virtctl package must be installed on the client machine.

  • The client machine must be configured to trust the OpenShift Container Platform router’s certificate.

Procedure
  1. Identify the following items:

    • File location of the VM disk image you want to upload

    • Name and size required for the resulting PVC

  2. Run the virtctl image-upload command to upload your VM image. You must specify the PVC name, PVC size, and file location. For example:

    $ virtctl image-upload --pvc-name=upload-fedora-pvc --pvc-size=10Gi --image-path=/images/fedora28.qcow2

    To allow insecure server connections when using HTTPS, use the --insecure parameter. Be aware that when you use the --insecure flag, the authenticity of the upload endpoint is not verified.

  3. To verify that the PVC was created, view all PVC objects:

    $ oc get pvc