Configure NeonSAN CSI

NeonSAN is an enterprise-grade distributed block storage system developed by QingCloud. NeonSAN CSI is a storage plugin provided by the NeonSAN team for Kubernetes, which enables dynamic provisioning of persistent storage volumes on the Kubernetes platform.

This section explains how to configure NeonSAN CSI for KubeSphere clusters in a production environment.

Prerequisites

  • NeonSAN v2.2.0 or above has been successfully deployed, and each node in the container cluster is connected to NeonSAN by the installed QBD. For specific operations, please consult KubeSphere technical support.

  • Kubernetes v1.16 or above has been installed.

  • Helm has been installed on the master node of the container cluster. Helm 3 is used as an example in this section.

Steps

Online Installation of NeonSAN CSI

Online installation is applicable to container cluster that has access to the Internet.

  1. Execute the following command to add the Helm repository, such as https://charts.kubesphere.io/test.

    1. $ helm repo add ks-test https://charts.kubesphere.io/test
    2. "ks-test" has been added to your repositories
  2. Execute the following command to check if the repository has been added successfully.

    1. $ helm repo list
    2. NAME URL
    3. ks-test https://charts.kubesphere.io/test
  3. Execute the following command to update the repository’s chart list.

    1. $ helm repo update
  4. Execute the following command to search for the installation package of NeonSAN CSI in the repository.

    1. $ helm search repo neonsan
    2. NAME CHART VERSION APP VERSION DESCRIPTION
    3. ks-test/csi-neonsan 1.2.2 1.2.0 A Helm chart for NeonSAN CSI Driver
  5. Check the version of qbd installed on the master node.

    1. $ qbd -v
    2. Package Version: 2.2.0-336092c-202202101432-ubuntu2004
    3. Loaded Module Version: 2.2.0-336092c-202209010306-testlangchaor01n01
    4. NeonSAN Static Library Version: 3.0.0-092498bf
    5. NeonSAN Protocol Version: 1
  6. Execute the following command to install NeonSAN CSI. Set the parameter driver.repository based on the qbd version installed on the master node. For example, if the qbd version is 2.2.0, the parameter in the command should be driver.repository=”csiplugin/csi-neonsan-qbd2.2.0”.

    1. $ helm install csi-neonsan ks-test/csi-neonsan --namespace kube-system --set driver.tag="v1.2.3" --set sc.rep_count=2 --set driver.repository="csiplugin/csi-neonsan-qbd2.2.0"
    2. NAME: csi-neonsan
    3. LAST DEPLOYED: Fri Nov 20 10:28:32 2020
    4. NAMESPACE: kube-system
    5. STATUS: deployed
    6. REVISION: 1
    7. TEST SUITE: None
  7. Execute the following command to check if NeonSAN CSI is installed successfully.

    1. $ helm list -n kube-system
    2. NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
    3. csi-neonsan kube-system 1 2020-11-20 10:28:32.240990384 +0800 CST deployed csi-neonsan-1.2.2 1.2.0
  8. Check if the pod is in Running state.

    1. $ kubectl get pod -n kube-system | grep csi-neonsan
    2. kube-system csi-neonsan-controller-75dc5cbcff-6gk54 5/5 Running 0 38s
    3. kube-system csi-neonsan-node-8vd8l 2/2 Running 0 38s
    4. kube-system csi-neonsan-node-dxk2z 2/2 Running 0 38s
    5. kube-system csi-neonsan-node-mp2b2 2/2 Running 0 38s
  9. Check if all NeonSAN CSI components are running normally.

    • When READY equals AVAILABLE, the csi-neonsan-controller is normal.

      1. $ kubectl -n kube-system get deployments.apps csi-neonsan-controller
      2. NAME READY UP-TO-DATE AVAILABLE AGE
      3. csi-neonsan-controller 1/1 1 1 66m
    • When DESIRED equals READY and AVAILABLE, the csi-neonsan-node is normal.

      1. $ kubectl -n kube-system get daemonsets.apps csi-neonsan-node
      2. NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
      3. csi-neonsan-node 3 3 3 3 3 <none> 66m
  10. Check if the storage class is installed.

    1. $ kubectl get storageclass
    2. NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
    3. csi-neonsan neonsan.csi.qingstor.com Delete Immediate true 2m56s
  11. View the storage pool used by the storage class. This storage pool must exist in NeonSAN, otherwise you cannot create storage volumes using this storage class.

    1. $ kubectl get storageclass csi-neonsan -o yaml | grep pool_name
    2. pool_name: kube
  12. Log in to the NeonSAN server and check if the storage pool used by the storage class exists. If not, create the storage pool using the neonsan create_pool command.

    1. $ neonsan list_pool -pool kube -detail
    2. Pool Count: 1
    3. +----------+------+---------------------------+
    4. | ID | NAME | CREATED TIME |
    5. +----------+------+---------------------------+
    6. | 33554432 | kube | 2020-08-07T14:53:52+08:00 |
    7. +----------+------+---------------------------+

Offline Installation of NeonSAN CSI

Offline installation is applicable to container clusters that cannot access the Internet.

  1. On your local machine, download the NeonSAN CSI installation package and copy the package to the cluster Master node.

    1. $ helm repo add ks-test https://charts.kubesphere.io/test
    2. "ks-test" has been added to your repositories
    3. $ helm pull ks-test/csi-neonsan
    4. $ ls -l csi-neonsan*.tgz
    5. -rw-r--r--. 1 root root 5196 Nov 20 13:13 csi-neonsan-1.2.2.tgz
  2. Execute the following command to view all image files required by NeonSAN CSI.

    1. $ helm show values ks-test/csi-neonsan
    2. driver:
    3. repository: csiplugin/csi-neonsan
    4. tag: v1.2.0
    5. node:
    6. repository: csiplugin/csi-neonsan-ubuntu
    7. tag: v1.2.0
    8. provisioner:
    9. repository: csiplugin/csi-provisioner
    10. tag: v1.5.0
    11. volumeNamePrefix: pvc
    12. attacher:
    13. repository: csiplugin/csi-attacher
    14. tag: v2.1.1
    15. resizer:
    16. repository: csiplugin/csi-resizer
    17. tag: v0.4.0
    18. snapshotter:
    19. repository: csiplugin/csi-snapshotter
    20. tag: v2.0.1
    21. registrar:
    22. repository: csiplugin/csi-node-driver-registrar
    23. tag: v1.2.0
  3. Use Docker to download all images locally and package them, or upload them to an internal repository (such as harbor).

    1. docker pull csiplugin/csi-neonsan:v1.2.0
    2. docker pull csiplugin/csi-neonsan-ubuntu:v1.2.0
    3. docker pull csiplugin/csi-provisioner:v1.5.0
    4. docker pull csiplugin/csi-attacher:v2.1.1
    5. docker pull csiplugin/csi-resizer:v0.4.0
    6. docker pull csiplugin/csi-snapshotter:v2.0.1
    7. docker pull csiplugin/csi-node-driver-registrar:v1.2.0
    1. docker save csiplugin/csi-neonsan:v1.2.0 \
    2. csiplugin/csi-neonsan-ubuntu:v1.2.0 \
    3. csiplugin/csi-provisioner:v1.5.0 \
    4. csiplugin/csi-attacher:v2.1.1 \
    5. csiplugin/csi-resizer:v0.4.0 \
    6. csiplugin/csi-snapshotter:v2.0.1 \
    7. csiplugin/csi-node-driver-registrar:v1.2.0 \
    8. -o neonsan-csi-images.tar
  4. Execute the following commands to upload the image package to a directory on all nodes in the cluster, such as the /tmp directory, extract it, and install it.

    1. $ scp neonsan-csi-images.tar user@node1:/tmp/
    2. scp neonsan-csi-images.tar user@node2:/tmp/
    3. ...
    1. $ tar -xvf /tmp/neonsan-csi-images.tar -C /
  5. Execute the following commands to check if the installation is complete. If you see all the NeonSAN CSI images in the list, the installation is successful.

    1. $ docker images
  6. Refer to the steps 8 - 12 of online installation for post-installation checks.

    After successfully installing NeonSAN CSI, you can view it in the Storage section on the KubeSphere web console.