• Stars
    star
    243
  • Rank 166,489 (Top 4 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dynamically provision Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is integrated with a backend LVM2 data storage stack.

OpenEBS LVM CSI Driver

FOSSA Status CII Best Practices Slack Community Meetings Go Report FOSSA Status

OpenEBS Logo

CSI driver for provisioning Local PVs backed by LVM and more.

Project Status

LVM-LocalPV CSI Driver is declared GA in August 2021 with the release version as 0.8.0.

Project Tracker

See roadmap.

Usage

Prerequisites

Before installing LVM driver please make sure your Kubernetes Cluster must meet the following prerequisites:

  1. all the nodes must have lvm2 utils installed and the dm-snapshot kernel module loaded
  2. volume group has been setup for provisioning the volume
  3. You have access to install RBAC components into kube-system namespace. The OpenEBS LVM driver components are installed in kube-system namespace to allow them to be flagged as system critical components.

Supported System

K8S : 1.20+

OS : Ubuntu

LVM version : LVM 2

Setup

Find the disk which you want to use for the LVM, for testing you can use the loopback device

truncate -s 1024G /tmp/disk.img
sudo losetup -f /tmp/disk.img --show

Create the Volume group on all the nodes, which will be used by the LVM Driver for provisioning the volumes

sudo pvcreate /dev/loop0
sudo vgcreate lvmvg /dev/loop0       ## here lvmvg is the volume group name to be created

Installation

We can install the latest release of OpenEBS LVM driver by running the following command.

$ kubectl apply -f https://openebs.github.io/charts/lvm-operator.yaml

If you want to fetch a versioned manifest, you can use the manifests for a specific OpenEBS release version, for example:

$ kubectl apply -f https://raw.githubusercontent.com/openebs/charts/gh-pages/versioned/3.0.0/lvm-operator.yaml

NOTE: For some Kubernetes distributions, the kubelet directory must be changed at all relevant places in the YAML powering the operator (both the openebs-lvm-controller and openebs-lvm-node).

  • For microk8s, we need to change the kubelet directory to /var/snap/microk8s/common/var/lib/kubelet/, we need to replace /var/lib/kubelet/ with /var/snap/microk8s/common/var/lib/kubelet/ at all the places in the operator yaml and then we can apply it on microk8s.

  • For k0s, the default directory (/var/lib/kubelet) should be changed to /var/lib/k0s/kubelet.

  • For RancherOS, the default directory (/var/lib/kubelet) should be changed to /opt/rke/var/lib/kubelet.

Verify that the LVM driver Components are installed and running using below command :

$ kubectl get pods -n kube-system -l role=openebs-lvm

Depending on number of nodes, you will see one lvm-controller pod and lvm-node daemonset running on the nodes.

NAME                       READY   STATUS    RESTARTS   AGE
openebs-lvm-controller-0   5/5     Running   0          35s
openebs-lvm-node-54slv     2/2     Running   0          35s
openebs-lvm-node-9vg28     2/2     Running   0          35s
openebs-lvm-node-qbv57     2/2     Running   0          35s

Once LVM driver is successfully installed, we can provision volumes.

Deployment

1. Create a Storage class

$ cat sc.yaml

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: openebs-lvmpv
parameters:
  storage: "lvm"
  volgroup: "lvmvg"
provisioner: local.csi.openebs.io

Check the doc on storageclasses to know all the supported parameters for LVM-LocalPV

VolumeGroup Availability

If LVM volume group is available on certain nodes only, then make use of topology to tell the list of nodes where we have the volgroup available. As shown in the below storage class, we can use allowedTopologies to describe volume group availability on nodes.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: openebs-lvmpv
allowVolumeExpansion: true
parameters:
  storage: "lvm"
  volgroup: "lvmvg"
provisioner: local.csi.openebs.io
allowedTopologies:
- matchLabelExpressions:
  - key: kubernetes.io/hostname
    values:
      - lvmpv-node1
      - lvmpv-node2

The above storage class tells that volume group "lvmvg" is available on nodes lvmpv-node1 and lvmpv-node2 only. The LVM driver will create volumes on those nodes only.

Please note that the provisioner name for LVM driver is "local.csi.openebs.io", we have to use this while creating the storage class so that the volume provisioning/deprovisioning request can come to LVM driver.

2. Create the PVC

$ cat pvc.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: csi-lvmpv
spec:
  storageClassName: openebs-lvmpv
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 4Gi

Create a PVC using the storage class created for the LVM driver.

3. Deploy the application

Create the deployment yaml using the pvc backed by LVM storage.

$ cat fio.yaml

apiVersion: v1
kind: Pod
metadata:
  name: fio
spec:
  restartPolicy: Never
  containers:
  - name: perfrunner
    image: openebs/tests-fio
    command: ["/bin/bash"]
    args: ["-c", "while true ;do sleep 50; done"]
    volumeMounts:
       - mountPath: /datadir
         name: fio-vol
    tty: true
  volumes:
  - name: fio-vol
    persistentVolumeClaim:
      claimName: csi-lvmpv

After the deployment of the application, we can go to the node and see that the lvm volume is being used by the application for reading/writting the data and space is consumed from the LVM. Please note that to check the provisioned volumes on the node, we need to run pvscan --cache command to update the lvm cache and then we can use lvdisplay and all other lvm commands on the node.

4. Deprovisioning

for deprovisioning the volume we can delete the application which is using the volume and then we can go ahead and delete the pv, as part of deletion of pv this volume will also be deleted from the volume group and data will be freed.

$ kubectl delete -f fio.yaml
pod "fio" deleted
$ kubectl delete -f pvc.yaml
persistentvolumeclaim "csi-lvmpv" deleted

Features

  • Access Modes
    • ReadWriteOnce
    • ReadOnlyMany
    • ReadWriteMany
  • Volume modes
    • Filesystem mode
    • Block mode
  • Supports fsTypes: ext4, btrfs, xfs
  • Volume metrics
  • Topology
  • Snapshot
  • Clone
  • Volume Resize
  • Thin Provision
  • Backup/Restore
  • Ephemeral inline volume

Limitation

  • Resize of volumes with snapshot is not supported

License

FOSSA Status

Repobeats

Alt

More Repositories

1

openebs

Most popular & widely deployed Open Source Container Native Storage platform for Stateful Persistent Applications on Kubernetes.
8,910
star
2

mayastor

Dynamically provision Stateful Persistent Replicated Cluster-wide Fabric Volumes & Filesystems for Kubernetes that is provisioned from an optimized NVME SPDK backend data storage stack.
Rust
712
star
3

zfs-localpv

Dynamically provision Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is integrated with a backend ZFS data storage stack.
Go
411
star
4

maya

Manage Container Attached Storage (CAS) - Data Engines in Kubernetes
Go
187
star
5

node-disk-manager

Kubernetes Storage Device Management
Go
181
star
6

dynamic-nfs-provisioner

Operator for dynamically provisioning an NFS server on any Kubernetes Persistent Volume. Also creates an NFS volume on the dynamically provisioned server for enabling Kubernetes RWX volumes.
Go
150
star
7

jiva

CAS Data Engine - iSCSI Distributed Block Storage Controller built-in Go
Go
139
star
8

dynamic-localpv-provisioner

Dynamically deploy Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is provisioned from simple Local-Hostpath /root storage.
Go
137
star
9

charts

OpenEBS Helm Charts and other utilities
Mustache
100
star
10

cstor-operators

Collection of OpenEBS cStor Data Engine Operators
Go
91
star
11

rawfile-localpv

Dynamically deploy Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is provisioned from RAW-device file loop mounted Local-Hostpath storage.
Python
72
star
12

velero-plugin

Velero plugin for backup/restore of OpenEBS cStor volumes
Go
61
star
13

spdk-rs

Enables building safer SPDK-based Rust applications
Rust
53
star
14

jiva-operator

Kubernetes Operator for managing Jiva Volumes via custom resource.
Go
47
star
15

openebs-docs

OpenEBS Documentation
JavaScript
37
star
16

mayastor-control-plane

Control plane for OpenEBS Mayastor
Rust
33
star
17

cstor-csi

cStor CSI Driver
Go
32
star
18

monitoring

OpenEBS Monitoring add-on. A set of Grafana, Prometheus, and alert manager plugins.
Jsonnet
30
star
19

openebsctl

`openebsctl` is a kubectl plugin to manage OpenEBS storage components.
Go
28
star
20

device-localpv

CSI Driver for using Local Block Devices
Go
24
star
21

istgt

CAS Data Engine - iSCSI Target for OpenEBS cStor
C
23
star
22

vhost-user

vhost for containerised storage
C
22
star
23

mayastor-extensions

Components and utilities which extend the Mayastor core control & data plane functionality
Rust
18
star
24

libcstor

CAS Data Engine - Library to serve IOs on uZFS with synchronous replication, snapshots and clones
C
18
star
25

performance-benchmark

Performance benchmarking for containerised storage solutions
Shell
17
star
26

elves

Helpers of OpenEBS
Python
16
star
27

website

OpenEBS Website and User Documentation
TypeScript
13
star
28

spdk-sys

Rust bindings for SPDK
Rust
12
star
29

upgrade

contains components that help with OpenEBS data engine upgrades
Go
10
star
30

e2e-tests

E2e tests for OpenEBS. The tests are run on various platforms and results can be seen at https://openebs.ci
Jinja
10
star
31

community-archive

Please refer to https://github.com/openebs/openebs for community updates.
Shell
9
star
32

api

The canonical location of the OpenEBS API definition.
Go
7
star
33

mayastor-docs

Official GitBook-based documentation for OpenEBS Mayastor
JavaScript
6
star
34

helm-operator

Helm Operator for OpenEBS Installation
Makefile
6
star
35

mayastor-dependencies

MayaData Dependencies
Rust
6
star
36

linux-utils

OpenEBS apline based docker images with linux utilities used for launching helper jobs.
Makefile
5
star
37

lib-csi

common packages used by OpenEBS CSI Drivers
Go
4
star
38

mayastor-api

Nix
4
star
39

monitor-pv

custom stats collector for OpenEBS persistent volumes
Shell
4
star
40

data-populator

data populator
Go
3
star
41

community

OpenEBS community resources
3
star
42

jiva-csi

CSI Driver for OpenEBS Jiva Volumes
Go
2
star
43

sts-pv-pvc-handler

Go
2
star
44

moac

The moac control plane for OpenEBS Mayastor has been deprecated as of release v1.0
JavaScript
2
star
45

mayastor-charts

Shell
1
star
46

m-exporter

Go
1
star
47

openebs-k8s-provisioner

Kubernetes external provisioner for OpenEBS cStor and Jiva Volume.
Go
1
star
48

.github

Top level project User Experience repo
1
star
49

google-analytics-4

Google analytics version 4 client for OpenEBS engines
Go
1
star