Creating an SFS Turbo Volume in the subpath Mode
Notes and Constraints
- Only clusters of v1.15 and later are supported.
- The cluster must use the everest add-on of version 1.1.13 or later.
- Kata containers are not supported.
Creating an SFS Turbo Volume of the subpath Type
In this version, the operations related to this feature are not allowed on the CCE console, such as scaling, disassociating, and deleting subpath volumes. An unknown error may occur if such an operation is performed on the CCE console.
- Import an SFS Turbo file system that is located in the same VPC and subnet as the cluster.
- Create a StorageClass YAML file, for example, sfsturbo-sc-test.yaml.
Configuration example:
apiVersion: storage.k8s.io/v1 allowVolumeExpansion: true kind: StorageClass metadata: name: sfsturbo-sc-test mountOptions: - nolock=false parameters: csi.storage.k8s.io/csi-driver-name: sfsturbo.csi.everest.io csi.storage.k8s.io/fstype: nfs everest.io/archive-on-delete: "true" everest.io/share-access-to: 7ca2dba2-1234-1234-1234-626371a8fb3a everest.io/share-expand-type: bandwidth everest.io/share-export-location: 192.168.1.1:/sfsturbo/ everest.io/share-source: sfs-turbo everest.io/share-volume-type: STANDARD everest.io/volume-as: subpath everest.io/volume-id: 0d773f2e-1234-1234-1234-de6a35074696 provisioner: everest-csi-provisioner reclaimPolicy: Delete volumeBindingMode: Immediate
In this example:
- name: name of the StorageClass.
- mountOptions: This parameter is optional. Currently, only the nolock parameter can be configured. If mountOptions is not specified or nolock is set to true, the mount operation will be performed based on the nolock settings. If nolock is set to false, the lock settings are used.
- everest.io/volume-as: Set this parameter to subpath.
- everest.io/share-access-to: This parameter is optional. In subpath mode, set this parameter to the ID of the VPC where the SFS Turbo file system is located.
- everest.io/share-expand-type: This parameter is optional. If the type of the SFS Turbo file system is SFS Turbo Standard – Enhanced or SFS Turbo Performance – Enhanced, set this parameter to bandwidth.
- everest.io/share-export-location: root directory to be mounted. It consists of the SFS Turbo shared path and sub-directory. The shared path can be queried on the SFS Turbo console. The sub-directory is user-defined. The PVCs created by the StorageClass are located in the sub-directory.
- everest.io/share-volume-type: This parameter is optional. It specifies the SFS Turbo file system type. The value can be STANDARD or PERFORMANCE. This parameter must be used together with the everest.io/share-expand-type parameter. If this parameter is set to STANDARD, everest.io/share-expand-type must be set to bandwidth.
- everest.io/zone: This parameter is optional. Set it to the AZ where the SFS Turbo file system is located.
- everest.io/volume-id: ID of the SFS Turbo volume. You can query the volume ID on the SFS Turbo page.
- everest.io/archive-on-delete: If this parameter is set to true and the recycling policy is set to Delete, the original PV file will be archived when the PVC is deleted. The archive directory is named in the format of archived-$PV name.timestamp. If this parameter is set to false, the SFS Turbo sub-directory corresponding to the PV will be deleted. The default value is true.
- Run the kubectl create -f sfsturbo-sc-test.yaml command to create a StorageClass.
- Create a PVC YAML file named sfs-turbo-test.yaml.
Configuration example:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: sfs-turbo-test namespace: default spec: accessModes: - ReadWriteMany resources: requests: storage: 50Gi storageClassName: sfsturbo-sc-test volumeMode: FilesystemIn this example:
- name: name of the PVC.
- storageClassName: name of the StorageClass created in the previous step.
- storage: In the subpath mode, this parameter is invalid. The storage capacity is limited by the total capacity of the SFS Turbo file system. If the total capacity of the SFS Turbo file system is insufficient, expand the capacity on the SFS Turbo page in a timely manner.
- Run the kubectl create -f sfs-turbo-test.yaml command to create a PVC.
It is meaningless to conduct capacity expansion on an SFS Turbo volume created in the subpath mode. This operation does not expand the capacity of the SFS Turbo file system. You need to ensure that the total capacity of the SFS Turbo file system is not used up.
Creating a Deployment and Mounting an Existing Volume
- Create a Deployment YAML file named deployment-test.yaml. Configuration example:
apiVersion: apps/v1 kind: Deployment metadata: name: test-turbo-subpath-example namespace: default generation: 1 labels: appgroup: '' spec: replicas: 1 selector: matchLabels: app: test-turbo-subpath-example template: metadata: labels: app: test-turbo-subpath-example spec: containers: - image: nginx:latest name: container-0 volumeMounts: - mountPath: /tmp name: pvc-sfs-turbo-example restartPolicy: Always imagePullSecrets: - name: default-secret volumes: - name: pvc-sfs-turbo-example persistentVolumeClaim: claimName: sfs-turbo-testIn this example:
- name: name of the Deployment.
- image: image used by the Deployment.
- mountPath: mount path of the container. In this example, the volume is mounted to the /tmp directory.
- claimName: name of an existing PVC.
- Run the kubectl create -f deployment-test.yaml command to create a Deployment.
Creating a StatefulSet That Uses a Volume Dynamically Created in subpath Mode
- Create a StatefulSet YAML file named statefulset-test.yaml.
Configuration example:
apiVersion: apps/v1 kind: StatefulSet metadata: name: test-turbo-subpath namespace: default generation: 1 labels: appgroup: '' spec: replicas: 2 selector: matchLabels: app: test-turbo-subpath template: metadata: labels: app: test-turbo-subpath annotations: metrics.alpha.kubernetes.io/custom-endpoints: '[{"api":"","path":"","port":"","names":""}]' pod.alpha.kubernetes.io/initialized: 'true' spec: containers: - name: container-0 image: 'nginx:latest' env: - name: PAAS_APP_NAME value: deploy-sfs-nfs-rw-in - name: PAAS_NAMESPACE value: default - name: PAAS_PROJECT_ID value: 8190a2a1692c46f284585c56fc0e2fb9 resources: {} volumeMounts: - name: sfs-turbo-160024548582479676 mountPath: /tmp terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent restartPolicy: Always terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst securityContext: {} imagePullSecrets: - name: default-secret affinity: {} schedulerName: default-scheduler volumeClaimTemplates: - metadata: name: sfs-turbo-160024548582479676 namespace: default annotations: {} spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi storageClassName: sfsturbo-sc-test serviceName: wwww podManagementPolicy: OrderedReady updateStrategy: type: RollingUpdate revisionHistoryLimit: 10In this example:
- name: name of the StatefulSet.
- image: image used by the StatefulSet.
- mountPath: mount path of the container. In this example, the volume is mounted to the /tmp directory.
- spec.template.spec.containers.volumeMounts.name and spec.volumeClaimTemplates.metadata.name must be consistent because they have a mapping relationship.
- storageClassName: name of the created StorageClass.
- Run the kubectl create -f statefulset-test.yaml command to create a StatefulSet.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.