Coder Social home page Coder Social logo

iq-scm / spdk-csi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spdk/spdk-csi

0.0 0.0 0.0 278 KB

CSI driver to bring SPDK to Kubernetes storage through NVMe-oF or iSCSI. Supports dynamic volume provisioning and enables Pods to use SPDK storage transparently.

License: Apache License 2.0

Shell 15.65% Ruby 0.06% Go 80.88% Makefile 2.53% Dockerfile 0.69% Mustache 0.19%

spdk-csi's Introduction

SPDK CSI

About

This repo contains SPDK CSI (Container Storage Interface) plugin for Kubernetes.

SPDK CSI plugin brings SPDK to Kubernetes. It provisions SPDK logical volumes on storage node dynamically and enables Pods to access SPDK storage backend through NVMe-oF or iSCSI.

Please see SPDK CSI Design Document for detailed introduction.

Supported platforms

This plugin conforms to CSI Spec v1.6.0. It is currently developed and tested only on Kubernetes.

This plugin supports x86_64 and Arm64 architectures.

Project status

Status: Beta

Prerequisites

SPDK-CSI is currently developed and tested with Go 1.19, Docker 20.10 and Kubernetes 1.25.0 on Ubuntu 22.04.

Minimal requirement: Go 1.19+, Docker 18.03+ and Kubernetes 1.13+.

Setup

Build

  • $ make all

Build targets spdkcsi, lint, test.

  • $ make spdkcsi

Build SPDK-CSI binary _out/spdkcsi.

  • $ make lint

Lint code and scripts.

  • $ make golangci

Install golangci-lint and perform various go code static checks.

  • $ make yamllint

Lint yaml files if yamllint is installed. Requires yamllint 1.10+.

  • $ make test

Verify go modules and run unit tests. Requires SPDK target and JsonRPC HTTP proxy running on localhost. See deploy/spdk/README for details.

  • $ make e2e-test

Verify core features through Kubernetes end-to-end (e2e) test.

  • $ make image

Build SPDK-CSI docker image.

Parameters

spdkcsi executable accepts several command line parameters.

Parameter Type Description Default
--controller - enable controller service -
--node - enable node service -
--endpoint string communicate with sidecars /tmp/spdkcsi.sock
--drivername string driver name csi.spdk.io
--nodeid string node id -

Usage

Example deployment files can be found in deploy/kubernetes directory.

File Name Usage
storageclass.yaml StorageClass of provisioner "csi.spdk.io"
controller.yaml StatefulSet running CSI Controller service
node.yaml DaemonSet running CSI Node service
controller-rbac.yaml Access control for CSI Controller service
node-rbac.yaml Access control for CSI Node service
config-map.yaml SPDK storage cluster configurations
secret.yaml SPDK storage cluster access tokens
snapshotclass.yaml SnapshotClass of provisioner "csi.spdk.io"
driver.yaml CSIDriver object

NOTE:

Below example is a simplest test system running in a single host or VM. No NVMe device is required, memory based bdev is used instead. docs/multi-node.md introduces how to deploy SPDKCSI on multiple nodes with NVMe devices.


Prepare SPDK storage node

Follow deploy/spdk/README to deploy SPDK storage service on localhost.

Deploy SPDKCSI services

  1. Launch Minikube test cluster.
  $ cd scripts
  $ sudo ./minikube.sh up

  # Create kubectl shortcut (assume kubectl version 1.25.0)
  $ sudo ln -s /var/lib/minikube/binaries/v1.25.0/kubectl /usr/local/bin/kubectl

  # Wait for Kubernetes ready
  $ kubectl get pods --all-namespaces
  NAMESPACE     NAME                          READY   STATUS    RESTARTS   AGE
  kube-system   coredns-6955765f44-dlb88      1/1     Running   0          81s
  ......                                              ......
  kube-system   kube-apiserver-spdkcsi-dev    1/1     Running   0          67s
  ......                                              ......
  1. Install snapshot controller and CRD
  SNAPSHOT_VERSION="v3.0.3" ./scripts/install-snapshot.sh install

  # Check status
  $ kubectl get pod snapshot-controller-0
  NAME                    READY   STATUS    RESTARTS   AGE
  snapshot-controller-0   1/1     Running   0          6m14s
  1. Deploy SPDK-CSI services
  $ cd deploy/kubernetes
  $ ./deploy.sh

  # Check status
  $ kubectl get pods
  NAME                   READY   STATUS    RESTARTS   AGE
  spdkcsi-controller-0   3/3     Running   0          3m16s
  spdkcsi-node-lzvg5     2/2     Running   0          3m16s
  1. Deploy test pod
  $ cd deploy/kubernetes
  $ kubectl apply -f testpod.yaml

  # Check status
  $ kubectl get pv
  NAME                       CAPACITY   ...    STORAGECLASS   REASON   AGE
  persistentvolume/pvc-...   256Mi      ...    spdkcsi-sc              43s

  $ kubectl get pvc
  NAME                                ...   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
  persistentvolumeclaim/spdkcsi-pvc   ...   256Mi      RWO            spdkcsi-sc     44s

  $ kubectl get pods
  NAME                   READY   STATUS    RESTARTS   AGE
  spdkcsi-test           1/1     Running   0          1m31s

  # Check attached spdk volume in test pod
  $ kubectl exec spdkcsi-test mount | grep spdkcsi
  /dev/disk/by-id/nvme-..._spdkcsi-sn on /spdkvol type ext4 (rw,relatime)
  1. Deploy PVC snapshot
  # Create snapshot of the bound PVC
  $ cd deploy/kubernetes
  $ kubectl apply -f snapshot.yaml

  # Get details about the snapshot
  $ kubectl get volumesnapshot spdk-snapshot
  NAME            READYTOUSE   SOURCEPVC   ... SNAPSHOTCLASS         AGE
  spdk-snapshot   false        spdkcsi-pvc ... csi-spdk-snapclass    29s

  # Get details about the volumesnapshotcontent
  kubectl get volumesnapshotcontent
  $ kubectl get volumesnapshotcontent
  NAME        ...   READYTOUSE   RESTORESIZE   DELETIONPOLICY   DRIVER        VOLUMESNAPSHOTCLASS   VOLUMESNAPSHOT   AGE
  snapcontent-...   true         268435456     Delete           csi.spdk.io   csi-spdk-snapclass    spdk-snapshot    29s

Teardown

  1. Delete PVC snapshot
  cd deploy/kubernetes
  kubectl delete -f snapshot.yaml
  1. Delete test pod
  $ cd deploy/kubernetes
  $ kubectl delete -f testpod.yaml
  1. Delete SPDK-CSI services
  $ cd deploy/kubernetes
  $ ./deploy.sh teardown
  1. Delete snapshot controller and CRD
SNAPSHOT_VERSION="v3.0.3" ./scripts/install-snapshot.sh cleanup
  1. Teardown Kubernetes test cluster
  $ cd scripts
  $ sudo ./minikube.sh clean

Communication and Contribution

Please join SPDK community for communication and contribution.

Project progress is tracked in Trello board.

spdk-csi's People

Contributors

askervin avatar cyb70289 avatar haichaoli01 avatar halfzebra avatar karlatec avatar peluse avatar rollandf avatar trochumski avatar xinydev avatar yanjing1104 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.