An Disk CSI plugin is available to help simplify storage management. Once user creates PVC with the reference to a Disk storage class, disk and corresponding PV object gets dynamically created and becomes ready to be used by workloads.
Disk Snapshot: disk-snapshot
Block Volumes: disk-block
Shared Disk: disk-shared
Volume Attach Limits: volume-attach-limits
- Secret object with the authentication key for Disk
- StorageClass with diskplugin (default diskplugin.csi.alibabacloud.com name) as a provisioner name and information about disk(zoneId, regionId, type)
- Service Accounts with required RBAC permissions
diskplugin.csi.alibabacloud.com can be compiled in a form of a container.
To build a container:
$ cd build && sh build-disk.sh
You can create a Kubernetes Cluster on Alibaba cloud Container Service
If the cluster not in STS mode, you need to config AK info to plugin; Set ACCESS_KEY_ID, ACCESS_KEY_SECRET to environment;
# kubectl create -f ./deploy/disk/disk-plugin.yaml
Note: The plugin log style can be configured by environment variable: LOG_TYPE.
"host": logs will be printed into files which save to host(/var/log/alicloud/diskplugin.csi.alibabacloud.com.log);
"stdout": logs will be printed to stdout, can be printed by docker logs or kubectl logs.
"both": default option, log will be printed both to stdout and host file.
# kubectl create -f ./deploy/disk/disk-provisioner.yaml
# kubectl create -f ./examples/disk/storageclass.yaml
Important: storageclass.yaml, must be customized to match your environment: zoneId, zoneId;
# kubectl get pods | grep csi
The following output should be displayed:
# kubectl get pod
NAME READY STATUS RESTARTS AGE
csi-disk-attacher-0 1/1 Running 0 7s
csi-disk-plugin-4hg7v 2/2 Running 0 3s
csi-disk-plugin-rhjp9 2/2 Running 0 3s
csi-disk-plugin-x229t 2/2 Running 0 3s
# kubectl create -f ./examples/disk/deploy.yaml
# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
disk-pvc Bound pvc-64b3d1bd-96c0-11e8-89b1-00163e0c412f 25Gi RWO csi-disk 36m
# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-64b3d1bd-96c0-11e8-89b1-00163e0c412f 25Gi RWO Delete Terminating default/disk-pvc csi-disk 35m
# kubectl describe pv pvc-64b3d1bd-96c0-11e8-89b1-00163e0c412f
Name: pvc-64b3d1bd-96c0-11e8-89b1-00163e0c412f
Labels: <none>
Annotations: pv.kubernetes.io/provisioned-by=diskplugin.csi.alibabacloud.com
Finalizers: [kubernetes.io/pv-protection external-attacher/diskplugin.csi.alibabacloud.com]
StorageClass: csi-disk
Status: Terminating (lasts 2m)
Claim: default/disk-pvc
Reclaim Policy: Delete
Access Modes: RWO
Capacity: 25Gi
Node Affinity: <none>
Message:
Source:
Type: CSI (a Container Storage Interface (CSI) volume source)
Driver: diskplugin.csi.alibabacloud.com
VolumeHandle: d-2ze47lce65lv5g7zsb4y
ReadOnly: false
Events: <none>
# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-deployment1-5879d9db88-49n8m 1/1 Running 0 37m