kubernetes-csi-tencentcloud
CFS plugins implement interface of CSI. It can enable your Container Orchestrator to use Tencent Cloud File Storage.
- Static Provisioning - firstly, create a CFS filesystem on tencent cloud manually; then mount it inside container
- Dynamic Provisioning - use PVC to request the Kubernetes to create a CFS filesystem on behalf of user and consumes the filesystem from inside container
- Mount options - mount options can be specified in storageclass to define how the volume should be mounted
Requirements:
- Kubernetes v1.13.x+
- kube-apiserver and kubelet need
--allow-privileged=true
(for v1.15.x+, kubelet defaults to set--allow-privileged
to true) - feature gates
CSINodeInfo=true,CSIDriverRegistry=true
Note: If you use tke(Tencent Kubernetes Engine), you may not add TENCENTCLOUD_API_SECRET_ID
and TENCENTCLOUD_API_SECRET_KEY
.
# deploy/cfs/kubernetes/csi-provisioner-cfsplugin.yaml
...
- name: NODE_ID
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: CSI_ENDPOINT
value: unix://plugin/csi.sock
- name: TENCENTCLOUD_API_SECRET_ID
value: AKIDxxxxxxxxxxxxxxxxxxx
- name: TENCENTCLOUD_API_SECRET_KEY
value: xxxxxxxxxxxxxxxxxxxxxxxx
...
kubectl apply -f deploy/cfs/kubernetes/csi-cfs-rbac.yaml
If your k8s version >= 1.20
kubectl apply -f deploy/cfs/kubernetes/csi-cfs-csidriver-new.yaml
If your k8s version >= 1.16 && < 1.20
kubectl apply -f deploy/cfs/kubernetes/csi-cfs-csidriver-mid.yaml
If your k8s version >= 1.14 && < 1.16
kubectl apply -f deploy/cfs/kubernetes/csi-cfs-csidriver-old.yaml
If your k8s version >= 1.18
kubectl apply -f deploy/cfs/kubernetes/csi-nodeplugin-cfsplugin-new.yaml
kubectl apply -f deploy/cfs/kubernetes/csi-provisioner-cfsplugin-new.yaml
If your k8s version >= 1.14 && < 1.18
kubectl apply -f deploy/cfs/kubernetes/csi-nodeplugin-cfsplugin-mid.yaml
kubectl apply -f deploy/cfs/kubernetes/csi-provisioner-cfsplugin-mid.yaml
If your k8s version < 1.14
kubectl apply -f deploy/cfs/kubernetes/csi-attacher-cfsplugin.yaml
kubectl apply -f deploy/cfs/kubernetes/csi-nodeplugin-cfsplugin-old.yaml
kubectl apply -f deploy/cfs/kubernetes/csi-provisioner-cfsplugin-old.yaml
# deploy/cfs/examples/dynamic-provison-allinone.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: cfsauto
parameters:
# first you must modify vpcid and subnetid in storageclass parameters
vpcid: vpc-xxxxxxxx
subnetid: subnet-xxxxxxxx
provisioner: com.tencent.cloud.csi.cfs
kubectl create -f deploy/cfs/examples/dynamic-provison-allinone.yaml
Note: volumeHandle
in PV must be unique.
kubectl apply -f deploy/cfs/examples/static-allinone.yaml
- vpcid: Required. CFS csi plugin support create cfs in a vpc.
- subnetid: Required.
subnetid
must belong tovpcid
. - zone: select your CFS zone, like
ap-guangzhou-3
. - pgroupid: select a pgroup which you created in CFS console, default is
pgroupbasic
. - storagetype: default is
SD
currently. - resourcetags: Optional.
a:b,c:d
- host: Required. NFS host like
10.0.0.112
. - path: NFS path default is
/
. - vers: NFS version, support
3
and4
, default is4
. - options: mount options for NFS.