Local Storage Support

Harvester v1.4.0 allows you to use local storage on the host to create persistent volumes for your workloads with better performance and latency. This functionality is made possible by LVM, which provides logical volume management facilities on Linux.

Install and Enable harvester-csi-driver-lvm

The harvester-csi-driver-lvm add-on is a CSI driver that supports local path provisioning through LVM. It is not packaged into the Harvester ISO, but is available in the experimental-addons repository.

If you are using the Harvester kubeconfig file, you can perform the following steps:

  1. Install the add-on by running the following command:

    # kubectl apply -f https://raw.githubusercontent.com/harvester/experimental-addons/main/harvester-csi-driver-lvm/harvester-csi-driver-lvm.yaml
  2. On the Harvester UI, go to Advanced → Add-ons.

  3. Select harvester-csi-driver-lvm (Experimental), and then select ⋮ → Enable.

    enable lvm addon

Create a Volume Group for LVM

A volume group combines physical volumes to create a single storage structure that can be divided into logical volumes.

Harvester currently does not allow you to modify the volume group composition (add or remove disks) after you create a logical volume. This issue will be addressed in a future release.

  1. Verify that the harvester-csi-driver-lvm add-on is installed.

  2. On the Harvester UI, go to the Hosts screen.

  3. Select the target host, and then select ⋮ → Edit Config.

  4. On the Storage tab, add disks for the volume group.

    add disk to vg 01

    Configure the following settings for each selected disk:

    • Provisioner: Select LVM.

      add disk to vg 02
    • Volume Group: Select an existing volume group or specify a name for a new volume group.

      add disk to vg 03

      For more information about adding disks, see Multi-Disk Management.

  5. Click Save.

  6. On the host details screen, verify that the disks were added and the correct provisioner was set.

    add disk to vg 04

Create a StorageClass for LVM

You can only use one type of local volume in each volume group. If necessary, create different volume groups for the volume types that you want to use.

  1. On the Harvester UI, go to the Storage screen.

  2. Create a new StorageClass and select LVM in the Provisioner list.

    create lvm sc 01
  3. On the Parameters tab, configure the following settings:

    • Node: Select the target node for the intended workloads.

      create lvm sc 02
    • Volume Group Name: Select the volume group that you created.

      create lvm sc 03
    • Volume Group Type: Select the type of local volume that matches your requirements. Harvester currently supports striped* and dm-thin.

      create lvm sc 04
  4. Click Save.

  5. On the Storage screen, verify that the StorageClass was created and the correct provisioner was set.

    create lvm sc 05

For more information, see StorageClass.

Create a Volume with LVM

  1. On the Harvester UI, go to the Volumes screen.

  2. Create a new volume using the LVM StorageClass that you created.

    create lvm volume 01

    The status Not Ready is normal because Harvester creates the LVM volume only when the first workload is created.

  3. On the Virtual Machines screen, select the target virtual machine, and then select ⋮ → Add Volume.

    Because the LVM volume is a local volume, you must ensure that the target node of the LVM StorageClass is the node on which the virtual machine is scheduled.

  4. Specify the volume that you want to attach.

    attach lvm volume 01
  5. On the Volumes screen, verify that the state is In-use.

    attach lvm volume 02

You can also create a new virtual machine with the volume of the LVM StorageClass that you created. This virtual machine will be scheduled on the target node with local storage for the volume.

create vm with lvm volume 01
create vm with lvm volume 02

Create Snapshots for an LVM Volume

  1. On the Harvester UI, go to the Settings screen.

  2. In the csi-driver-config section, select ⋮ → Edit Setting.

    update csi driver config 01
  3. Add an entry with the following settings:

    • Provisioner: Select lvm.driver.harvesterhci.io.

    • Volume Snapshot Class Name: Select lvm-snapshot.

    • Backup Volume Snapshot Class Name: Select lvm-snapshot.

      update csi driver config 02
  4. On the Virtual Machines screen, select the target virtual machine, and then select ⋮ → Take Virtual Machine Snapshot.

    Example:

    vm take snapshot with lvm 01
  5. On the Virtual Machine Snapshots screen, verify that snapshot is ready to use.

    vm take snapshot with lvm 02

Supported LVM Volume Features

  • Volume resizing

  • Volume cloning

  • Snapshot creation

Backup creation is currently not supported. This limitation will be addressed in a future release.