apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-neonsan
provisioner: neonsan.csi.qingstor.com
parameters:
fsType: "ext4"
rep_count: "1"
pool_name: "kube"
reclaimPolicy: Delete
allowVolumeExpansion: true
Support ext3
, ext4
, xfs
, default ext4
.
Number of disk replicas, default 1
,maximum 3
.
Neonsan pool name,not empty
Set the annotation .metadata.annotations.storageclass.beta.kubernetes.io/is-default-class
value as true
. See details in Kubernetes docs
Set the value of .allowVolumeExpansion
as true
. See details in Kubernetes docs
Volume management including dynamical provisioning/deleting volume, attaching/detaching volume. Please reference Example YAML Files.
- Kubernetes 1.14+
- Neonsan CSI installed
- Neonsan CSI StorageClass created
- Create
$ kubectl create -f sc.yaml
- Check
$ kubectl get sc
NAME PROVISIONER AGE
csi-neonsan neonsan.csi.qingstor.com 14m
- Create
$ kubectl create -f pvc.yaml
persistentvolumeclaim/pvc-test created
- Check
$ kubectl get pvc pvc-test
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-test Bound pvc-76429525-a930-11e9-9a6a-5254ef68c8c1 20Gi RWO csi-neonsan 25m
- Create Deployment
$ kubectl create -f deploy-nginx.yaml
deployment.apps/nginx created
- Check
$ kubectl exec -ti nginx-84474cf674-zfhbs /bin/bash
# cd /mnt
# ls
lost+found
- Delete Deployment
$ kubectl delete deploy nginx
deployment.extensions "nginx" deleted
- Delete
$ kubectl delete pvc pvc-test
persistentvolumeclaim "pvc-test" deleted
- Check
$ kubectl get pvc pvc-test
Error from server (NotFound): persistentvolumeclaims "pvc-example" not found
This plugin only supports offline volume expansion. The procedure of offline volume expansion is shown as follows.
- Ensure volume in unmounted status
- Edit the capacity of PVC
- Mount volume on workload Please reference Example YAML files.
- Kubernetes 1.14+ cluster
- Add
ExpandCSIVolumes=true
infeature-gate
- Set
allowVolumeExpansion
astrue
in StorageClass - Create a Pod mounting a volume
$ kubectl scale deploy nginx --replicas=0
- Change Volume capacity
$ kubectl patch pvc pvc-test -p '{"spec":{"resources":{"requests":{"storage": "40Gi"}}}}'
persistentvolumeclaim/pvc-test patched
- Mount Volume
$ kubectl scale deploy nginx --replicas=1
- Check PVC Capacity
$ kubectl get pvc pvc-test
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-test Bound pvc-906f5760-a935-11e9-9a6a-5254ef68c8c1 40Gi RWO csi-qingcloud 6m7s
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-6c444c9b7f-d6n29 1/1 Running 0 3m38s
$ kubectl exec -ti nginx-6c444c9b7f-d6n29 /bin/bash
root@nginx-6c444c9b7f-d6n29:/# df -ah
Filesystem Size Used Avail Use% Mounted on
...
/dev/vdc 40G 49M 40G 1% /mnt
...
Cloning is defined as a duplicate of an existing PVC. Please reference Example YAML
- Kubernetes 1.15+
- Enable
VolumePVCDataSource=true
feature gat - Neonsan CSI installed
- Neonsan CSI StorageClass created
- Source PVC created
- Check source PVC
$ kubectl get pvc pvc-test
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-test Bound pvc-3bdbde24-7016-430e-b217-9eca185caca3 20Gi RWO csi-neonsan 3h16
- Clone Volume
$ kubectl create -f pvc-clone.yaml
persistentvolumeclaim/pvc-clone created
- Check
$ kubectl get pvc pvc-clone
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-clone Bound pvc-a75e3f7c-59af-43ef-82d3-300508871432 20Gi RWO csi-neonsan 7m4s
Snapshot management contains creating/deleting snapshot and restoring volume from snapshot. Please reference Example YAML files.
- Kubernetes 1.14+
- Enable
VolumeSnapshotDataSource=true
feature gate at kube-apiserver and kube-controller-manager - Neonsan CSI v1.2.0 installed
- Neonsan CSI StorageClass created
- Source PVC created
- Create
$ kubectl create -f pvc-source.yaml
persistentvolumeclaim/pvc-source created
- Check
$ kubectl get pvc pvc-source
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-source Bound pvc-3bdbde24-7016-430e-b217-9eca185caca3 20Gi RWO csi-neonsan 4h25m
$ kubectl create -f snapshot-class.yaml
volumesnapshotclass.snapshot.storage.k8s.io/csi-neonsan created
$ kubectl get volumesnapshotclass
NAME AGE
csi-neonsdan 16s
$ kubectl create -f snapshot.yaml
volumesnapshot.snapshot.storage.k8s.io/snap-1 created
$ kubectl get volumesnapshot
NAME AGE
snap-1 91s
$ kubectl create -f pvc-snapshot.yaml
persistentvolumeclaim/pvc-snap created
$ kubectl get pvc pvc-snap
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pvc-snap Bound pvc-a56f6ebe-b37b-40d7-bfb7-aafbecb6672b 20Gi RWO csi-neonsan 59m
$ kubectl delete volumesnapshot snap-1
volumesnapshot.snapshot.storage.k8s.io "snap-1" deleted