The LXD CSI driver is an open source implementation of the Container Storage Interface (CSI) that integrates LXD storage backends with Kubernetes. It allows dynamic storage volume provisioning using storage drivers supported by LXD.
Warning
The LXD CSI driver is still in the early stages, and backwards compatibility is not guaranteed.
The LXD CSI driver is documented as part of the official LXD documentation.
Relevant sections include:
- An overview of the LXD CSI driver architecture and lifecycle
- Instructions on how to install and use the LXD CSI driver
- The reference documentation for the LXD CSI driver CLI and Helm chart
This guide explains how to deploy the LXD CSI driver in your Kubernetes cluster.
Important
If you’re installing the LXD CSI driver for the first time, we recommend first reviewing the LXD CSI driver explanation to understand its functionality, and then following the installation and usage guide.
You need a Kubernetes cluster (of any size) that is running on LXD instances within a dedicated LXD project.
This guide assumes the LXD project is named lxd-csi-project
.
Enable DevLXD volume management on all LXD instances where CSI will be running:
lxc config set <instance> --project lxd-csi-project security.devlxd.management.volumes=true
Note
LXD CSI is limited to Kubernetes clusters that are running within a single LXD project.
Create a new authorization group csi-group
with the permissions to view the project, manage storage volumes, and edit instances:
lxc auth group create csi-group
lxc auth group permission add csi-group project lxd-csi-project can_view
lxc auth group permission add csi-group project lxd-csi-project storage_volume_manager
lxc auth group permission add csi-group project lxd-csi-project can_edit_instances
Next, create an identity devlxd/csi
and assign the previously created group csi-group
to it:
lxc auth identity create devlxd/csi
lxc auth identity group add devlxd/csi csi-group
Finally, issue a new bearer token to be used by the CSI driver:
token=$(lxc auth identity token issue devlxd/csi --quiet)
Create a namespace lxd-csi
:
kubectl create namespace lxd-csi --save-config
Create a Kubernetes secret lxd-csi-secret
containing a previously created bearer token:
kubectl create secret generic lxd-csi-secret \
--namespace lxd-csi \
--from-literal=token="${token}"
Deploy LXD CSI driver using Helm:
helm install lxd-csi-driver oci://ghcr.io/canonical/charts/lxd-csi-driver \
--version v0.0.0-latest-edge \
--namespace lxd-csi
To use the CSI driver, create a Kubernetes StorageClass that points to the LXD storage pool you want to manage. See LXD CSI driver usage examples in the LXD documentation.