Configuring SFS Volume Mount Options
This section describes how to configure SFS volume mount options. You can configure mount options in a PV and bind the PV to a PVC. Alternatively, configure mount options in a StorageClass and use the StorageClass to create a PVC. In this way, PVs can be dynamically created and inherit mount options configured in the StorageClass by default.
Prerequisites
The everest add-on version must be 1.2.8 or later. The add-on identifies the mount options and transfers them to the underlying storage resources, which determine whether the specified options are valid.
SFS Volume Mount Options
The everest add-on in CCE presets the options described in Table 1 for mounting SFS volumes.
Parameter |
Value |
Description |
---|---|---|
keep-original-ownership |
Leave it blank. |
Whether to retain the ownership of the file mount point. If this option is used, the everest add-on must be v1.2.63 or v2.1.2 or later.
|
vers |
3 |
File system version. Currently, only NFSv3 is supported. Value: 3 |
nolock |
Leave it blank. |
Whether to lock files on the server using the NLM protocol. If nolock is selected, the lock is valid for applications on one host. For applications on another host, the lock is invalid. |
timeo |
600 |
Waiting time before the NFS client retransmits a request. The unit is 0.1 seconds. Recommended value: 600 |
hard/soft |
Leave it blank. |
Mount mode.
The default value is hard. |
Configuring Mount Options in a PV
You can use the mountOptions field to configure mount options in a PV. The options you can configure in mountOptions are listed in SFS Volume Mount Options.
- Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
- Configure mount options in a PV. Example:
apiVersion: v1 kind: PersistentVolume metadata: annotations: pv.kubernetes.io/provisioned-by: everest-csi-provisioner everest.io/reclaim-policy: retain-volume-only # (Optional) The PV is deleted while the underlying volume is retained. name: pv-sfs spec: accessModes: - ReadWriteMany # Access mode. The value must be ReadWriteMany for SFS. capacity: storage: 1Gi # SFS volume capacity. csi: driver: disk.csi.everest.io # Dependent storage driver for the mounting. fsType: nfs volumeHandle: <your_volume_id> # ID of the SFS Capacity-Oriented volume. volumeAttributes: everest.io/share-export-location: <your_location> # Shared path of the SFS volume. storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner persistentVolumeReclaimPolicy: Retain # Reclaim policy. storageClassName: csi-nas # Storage class name. mountOptions: # Mount options. - vers=3 - nolock - timeo=600 - hard
- After a PV is created, you can create a PVC and bind it to the PV, and then mount the PV to the container in the workload. For details, see Using an Existing SFS File System Through a Static PV.
- Check whether the mount options take effect.
In this example, the PVC is mounted to the workload that uses the nginx:latest image. You can run the mount -l command to check whether the mount options take effect.
- View the pod to which the SFS volume has been mounted. In this example, the workload name is web-sfs.
kubectl get pod | grep web-sfs
Command output:
web-sfs-*** 1/1 Running 0 23m
- Run the following command to check the mount options (web-sfs-*** is an example pod):
kubectl exec -it web-sfs-*** -- mount -l | grep nfs
If the mounting information in the command output is consistent with the configured mount options, the mount options are set successfully.
<Your shared path> on /data type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=**.**.**.**,mountvers=3,mountport=2050,mountproto=tcp,local_lock=all,addr=**.**.**.**)
- View the pod to which the SFS volume has been mounted. In this example, the workload name is web-sfs.
Setting Mount Options in a StorageClass
You can use the mountOptions field to configure mount options in a StorageClass. The options you can configure in mountOptions are listed in SFS Volume Mount Options.
- Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
- Create a customized StorageClass. Example:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: csi-sfs-mount-option provisioner: everest-csi-provisioner parameters: csi.storage.k8s.io/csi-driver-name: nas.csi.everest.io csi.storage.k8s.io/fstype: nfs everest.io/share-access-to: <your_vpc_id> # VPC ID of the cluster. reclaimPolicy: Delete volumeBindingMode: Immediate mountOptions: # Mount options - vers=3 - nolock - timeo=600 - hard
- After the StorageClass is configured, you can use it to create a PVC. By default, the dynamically created PVs inherit the mount options configured in the StorageClass. For details, see Using an SFS File System Through a Dynamic PV.
- Check whether the mount options take effect.
In this example, the PVC is mounted to the workload that uses the nginx:latest image. You can run the mount -l command to check whether the mount options take effect.
- View the pod to which the SFS volume has been mounted. In this example, the workload name is web-sfs.
kubectl get pod | grep web-sfs
Command output:
web-sfs-*** 1/1 Running 0 23m
- Run the following command to check the mount options (web-sfs-*** is an example pod):
kubectl exec -it web-sfs-*** -- mount -l | grep nfs
If the mounting information in the command output is consistent with the configured mount options, the mount options are set successfully.
<Your shared path> on /data type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=**.**.**.**,mountvers=3,mountport=2050,mountproto=tcp,local_lock=all,addr=**.**.**.**)
- View the pod to which the SFS volume has been mounted. In this example, the workload name is web-sfs.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot