Local Storage Support

Available as of v1.4.0

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.

Installing and Enabling 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:
  1. # kubectl apply -f https://raw.githubusercontent.com/harvester/experimental-addons/main/harvester-csi-driver-lvm/harvester-csi-driver-lvm.yaml
  1. On the Harvester UI, go to Advanced > Add-ons.

  2. Select harvester-csi-driver-lvm (Experimental), and then select > Enable.

    Local Storage Support - 图1

Creating a Volume Group for LVM

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

Local Storage Support - 图2note

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.

    Local Storage Support - 图3

    Configure the following settings for each selected disk:

  • Provisioner: Select LVM.

    Local Storage Support - 图4

  • Volume Group: Select an existing volume group or specify a name for a new volume group.

    Local Storage Support - 图5

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

  1. Click Save.

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

    Local Storage Support - 图6

Creating a StorageClass for LVM

Local Storage Support - 图7note

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.

    Local Storage Support - 图8

  3. On the Parameters tab, configure the following settings:

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

    Local Storage Support - 图9

  • Volume Group Name: Select the volume group that you created.

    Local Storage Support - 图10

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

    Local Storage Support - 图11

  1. Click Save.

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

    Local Storage Support - 图12

For more information, see StorageClass.

Creating 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.

    Local Storage Support - 图13

    Local Storage Support - 图14note

    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.

    Local Storage Support - 图15note

    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.

    Local Storage Support - 图16

  5. On the Volumes screen, verify that the state is In-use.

    Local Storage Support - 图17

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.

Local Storage Support - 图18

Local Storage Support - 图19

Creating 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.

    Local Storage Support - 图20

  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.

    Local Storage Support - 图21

  1. On the Virtual Machines screen, select the target virtual machine, and then select > Take Virtual Machine Snapshot.

    Example:

    Local Storage Support - 图22

  2. On the Virtual Machine Snapshots screen, verify that snapshot is ready to use.

    Local Storage Support - 图23

Supported LVM Volume Features

  • Volume resizing
  • Volume cloning
  • Snapshot creation

Local Storage Support - 图24note

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