local_goosefsx_PV.yamlapiVersion: v1kind: PersistentVolumemetadata:name: csi-goosefsx-local-pvspec:accessModes:- ReadWriteManycapacity:storage: 10GivolumeMode: FilesystempersistentVolumeReclaimPolicy: DeletestorageClassName: local-storagelocal:# Replace the path here with the host mounting path of GooseFSx, then delete this reminderpath: /goosefsx/x-c60-ow1j60r9-proxynodeAffinity:required:nodeSelectorTerms:- matchExpressions:- key: kubernetes.io/archoperator: Invalues:- amd64
Parameter | Description |
name: csi-goosefsx-local-pv | Define the persistent volume name and modify according to actual conditions. |
accessModes: - ReadWriteMany | Define the access mode. "ReadWriteMany" means it can be mounted in read-write mode by multiple nodes. |
storage: 10Gi | Define the storage capacity. "10Gi" indicates 10GiB storage capacity. This parameter does not limit the capacity provided by the file system. The actual storage capacity is the purchased GooseFSx capacity and dynamically scales with GooseFSx expansion. For example, if the purchased GooseFSx capacity is 4.5TiB, the storage capacity is 4.5TiB (not 10GiB). After expanding GooseFSx to 9TiB, the storage capacity becomes 9TiB. |
volumeMode: Filesystem | Define the persistent volume mode as file system. |
persistentVolumeReclaimPolicy: Delete | Define the recycling policy, delete. |
storageClassName: local-storage | Define the persistent volume belonging to the class "local-storage". The persistent volume claim must belong to the same class "local-storage". The name "local-storage" should be consistent with the storage class file's name "local-storage". |
local: path: /goosefsx/x-c60-ow1j60r9-proxy | Define the container's storage space as the host machine's directory path "/goosefsx/x-c60-ow1j60r9-proxy", which is GooseFSx's mount directory on the host machine. Modify according to actual conditions. |
nodeAffinity | Define node affinity. |
local_goosefsx_PVC.yamlapiVersion: v1kind: PersistentVolumeClaimmetadata:name: local-goosefsx-pvcspec:accessModes:- ReadWriteManyresources:requests:storage: 10GistorageClassName: local-storage
Parameter | Description |
name: local-goosefsx-pvc | Define the persistent volume claim name and modify according to actual conditions. |
accessModes: - ReadWriteMany | Define access mode and persistent volume. |
resources: requests: storage: 10Gi | Define the storage capacity. "10Gi" indicates 10GiB storage capacity. This parameter does not limit the capacity provided by the file system. The actual storage capacity is the capacity purchased for GooseFSx and dynamically scales with GooseFSx expansion. For example, if the purchased GooseFSx capacity is 4.5TiB, the storage capacity is 4.5TiB (not 10GiB). After expanding GooseFSx to 9TiB, the storage capacity becomes 9TiB. |
storageClassName: local-storage | Define a persistent volume claim belonging to the class "local-storage". The persistent volume must belong to the same class "local-storage". The name "local-storage" should be consistent with the storage class file's name "local-storage". |
local_goosefsx_StorageClass.yamlkind: StorageClassapiVersion: storage.k8s.io/v1metadata:name: local-storageprovisioner: kubernetes.io/no-provisionervolumeBindingMode: WaitForFirstConsumer
Parameter | Description |
name: local-storage | Define a storage class named "local-storage". The yaml file for the PV persistent volume and the yaml file for the PVC persistent volume claim will use it. |
provisioner: kubernetes.io/no-provisioner | Define the provisioner for the PV persistent volume. GooseFSx's PV persistent volume is relatively simple, and auto-creating PV persistent volumes by using StorageClass is not required. |
volumeBindingMode:WaitForFirstConsumer | Define volume binding mode. This mode delays PersistentVolume binding and provisioning until the Pod using the PersistentVolumeClaim is created. |
kubectl apply -f local_goosefsx_storageclass.yaml

kubectl apply -f local_goosefsx_pv.yaml

kubectl apply -f local_goosefsx_pvc.yaml

local_goosefsx_Pod.yaml is as follows:apiVersion: apps/v1kind: Deploymentmetadata:labels:k8s-app: local-goosefsx-dpname: local-goosefsx-dpspec:replicas: 1selector:matchLabels:k8s-app: local-goosefsx-podtemplate:metadata:labels:k8s-app: local-goosefsx-podspec:containers:- image: nginxname: local-goosefsx-podvolumeMounts:- mountPath: /local-goosefsxname: local-goosefsx-pvvolumes:- name: local-goosefsx-pvpersistentVolumeClaim:claimName: local-goosefsx-pvc
kubectl apply -f local_goosefsx_pod.yaml

kubectl get pod

kubectl exec -ti local-goosefsx-dp-7fb9b9f877-fcttx -- /bin/sh
pv.yaml:apiVersion: v1kind: PersistentVolumemetadata:name: csi-goosefsx-pvspec:accessModes:- ReadWriteManycapacity:storage: 10Gicsi:driver: com.tencent.cloud.csi.goosefsxvolumeHandle: csi-goosefsx-pvstorageClassName: ""
pvc.yaml:apiVersion: v1kind: PersistentVolumeClaimmetadata:name: csi-goosefsx-pvcspec:accessModes:- ReadWriteManyresources:requests:storage: 10GivolumeName: csi-goosefsx-pvstorageClassName: ""
csi-driver.yaml:apiVersion: storage.k8s.io/v1kind: CSIDrivermetadata:name: com.tencent.cloud.csi.goosefsxspec:attachRequired: falsepodInfoOnMount: falsefsGroupPolicy: File
csi-node.yaml:kind: DaemonSetapiVersion: apps/v1metadata:name: csi-goosefsx-nodenamespace: kube-systemspec:selector:matchLabels:app: csi-goosefsx-nodetemplate:metadata:labels:app: csi-goosefsx-nodespec:serviceAccount: csi-goosefsx-nodepriorityClassName: system-node-criticalhostNetwork: truehostPID: truecontainers:- name: driver-registrarimage: ccr.ccs.tencentyun.com/tkeimages/csi-node-driver-registrar:v2.0.1lifecycle:preStop:exec:command: ["/bin/sh", "-c", "rm -rf /registration/com.tencent.cloud.csi.goosefex /registration/com.tencent.cloud.csi.goosefsx-reg.sock"]args:- "--v=5"- "--csi-address=$(ADDRESS)"- "--kubelet-registration-path=/var/lib/kubelet/plugins/com.tencent.cloud.csi.goosefsx/csi.sock"env:- name: ADDRESSvalue: /plugin/csi.sock- name: KUBE_NODE_NAMEvalueFrom:fieldRef:fieldPath: spec.nodeNamevolumeMounts:- name: plugin-dirmountPath: /plugin- name: registration-dirmountPath: /registration- name: goosefsxsecurityContext:privileged: truecapabilities:add: ["SYS_ADMIN"]allowPrivilegeEscalation: trueimage: ccr.ccs.tencentyun.com/qcloud_goosefsx/goosefsx-csi:v1.0.1args:- "--v=5"- "--logtostderr=true"- "--nodeID=$(NODE_ID)"- "--endpoint=$(CSI_ENDPOINT)"# Replace the fileSystemId here with the host mounting file system ID, then delete this reminder- "--filesystemId=x-c60-s1bz66l4"env:- name: NODE_IDvalueFrom:fieldRef:fieldPath: spec.nodeName- name: CSI_ENDPOINTvalue: unix://plugin/csi.sockvolumeMounts:- name: plugin-dirmountPath: /plugin- name: goosefsx-mount-dirmountPath: /goosefsxmountPropagation: "Bidirectional"- name: pods-mount-dirmountPath: /var/lib/kubelet/podsmountPropagation: "Bidirectional"volumes:- name: plugin-dirhostPath:path: /var/lib/kubelet/plugins/com.tencent.cloud.csi.goosefsxtype: DirectoryOrCreate- name: registration-dirhostPath:path: /var/lib/kubelet/plugins_registrytype: Directory- name: pods-mount-dirhostPath:path: /var/lib/kubelet/podstype: Directory- name: goosefsx-mount-dirhostPath:path: /goosefsxtype: Directory
csi-rbac.yaml:apiVersion: v1kind: ServiceAccountmetadata:name: csi-goosefsx-nodenamespace: kube-system---kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1metadata:name: csi-goosefsx-noderules:- apiGroups: [""]resources: ["persistentvolumeclaims/status"]verbs: ["patch", "update"]- apiGroups: [""]resources: ["configmaps", "events", "persistentvolumes","persistentvolumeclaims"]verbs: ["get", "list", "watch", "update", "patch"]- apiGroups: [""]resources: ["pods", "nodes"]verbs: ["get", "list", "watch"]- apiGroups: ["storage.k8s.io"]resources: ["storageclasses"]verbs: ["get", "list", "watch"]- apiGroups: ["storage.k8s.io"]resources: ["volumeattachments"]verbs: ["get", "list", "watch", "update"]- apiGroups: [""]resources: ["events"]verbs: ["list", "watch", "create", "update", "patch"]- apiGroups: ["coordination.k8s.io"]resources: ["leases"]verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]---kind: ClusterRoleBindingapiVersion: rbac.authorization.k8s.io/v1metadata:name: csi-goosefsx-nodesubjects:- kind: ServiceAccountname: csi-goosefsx-nodenamespace: kube-systemroleRef:kind: ClusterRolename: csi-goosefsx-nodeapiGroup: rbac.authorization.k8s.io
kubectl apply -f csi-rbac.yamlkubectl apply -f csi-driver.yamlkubectl apply -f csi-node.yaml
kubectl get ds -n kube-system
kubectl apply -f pv.yamlkubectl apply -f pvc.yaml
pod.yaml file as follows:apiVersion: apps/v1kind: Deploymentmetadata:labels:k8s-app: csi-goosefsx-podname: csi-goosefsx-podspec:replicas: 1selector:matchLabels:k8s-app: csi-goosefsx-podtemplate:metadata:labels:k8s-app: csi-goosefsx-podspec:containers:- image: nginxname: csi-goosefsx-podvolumeMounts:- mountPath: /csi-goosefsxname: csi-goosefsxvolumes:- name: csi-goosefsxpersistentVolumeClaim:claimName: csi-goosefsx-pvc
kubectl apply -f pod.yaml
kubectl get pod
Feedback