Skip to content

brlbil/csi-driver-lvm

 
 

Repository files navigation

csi-driver-lvm

CSI DRIVER LVM utilizes local storage of Kubernetes nodes to provide persistent storage for pods.

It automatically creates hostPath based persistent volumes on the nodes.

Underneath it creates a LVM logical volume on the local disks. A comma-separated list of grok pattern, which disks to use must be specified.

This CSI driver is derived from csi-driver-host-path and csi-lvm

Currently it can create, delete, mount, unmount and resize block and filesystem volumes via lvm

For the special case of block volumes, the filesystem-expansion has to be perfomend by the app using the block device

Installation

You have to set the devicePattern for your hardware to specify which disks should be used to create the volume group.

helm install mytest helm/csi-driver-lvm --set lvm.devicePattern='/dev/nvme[0-9]n[0-9]'

Now you can use one of following storageClasses:

  • csi-lvm-sc-mirror
  • csi-lvm-sc-linear
  • csi-lvm-sc-striped

Todo

  • implement CreateSnapshot(), ListSnapshots(), DeleteSnapshot()

Development

TL;DR:

./start-minikube-on-linux.sh
helm install mytest helm/csi-driver-lvm --set lvm.devicePattern='/dev/loop[0-1]'

Start minikube and create dummy volumes

minikube start --memory 4g
minikube ssh 'for i in 0 1; do fallocate -l 1G loop${i} ; sudo losetup -f loop${i}; sudo losetup -a ; done'

On minikube we have to copy a "real" losetup:

In minikube losetup is a symlink to busybox.

The busybox implentation of losetup lacks some flags on which the kubernetes currently depends on. (see kubernetes/kubernetes#83265 )

 minikube ssh 'sudo rm /sbin/losetup'
 scp -o 'StrictHostKeyChecking=no' -i $(minikube ssh-key) /usr/sbin/losetup  docker@$(minikube ip):/tmp/losetup
 minikube ssh 'sudo mv /tmp/losetup /sbin/losetup'

Build

make
docker build
docker push

Replace metalstack/lvmplugin:latest image in helm/csi-driver-lvm/values.yaml

Deploy

helm install mytest helm/csi-driver-lvm

Test

kubectl apply -f examples/csi-pvc-raw.yaml
kubectl apply -f examples/csi-pod-raw.yaml


kubectl apply -f examples/csi-pvc.yaml
kubectl apply -f examples/csi-app.yaml

kubectl delete -f examples/csi-pod-raw.yaml
kubectl delete -f examples/csi-pvc-raw.yaml

kubectl delete -f  examples/csi-app.yaml
kubectl delete -f examples/csi-pvc.yaml

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 85.9%
  • Shell 7.6%
  • Makefile 4.0%
  • Dockerfile 2.5%