You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
NFS access methods
Using vePFS PVs via NFS
Copy page
Download PDF
Using vePFS PVs via NFS
VKE supports vePFS access over the Network File System (NFS) protocol. This topic describes how to access vePFS over NFS by using the kubectl command-line tool.​
tip​
[Beta] The protocol service NFS is at the beta stage. To use this service, contact your account manager.​
Prerequisites​
  • vePFS protocol support has been enabled, and an NFS vePFS filesystem has been created.​
  • The kubectl tool has already been installed locally, and the target cluster has been connected by using kubectl. For details, see Connecting to a cluster.​
Using statically provisioned vePFS PVs​
Step 1: Create a PV​
  1. Create a YAML file for the PV. The following vke-pfs-static-pv.yaml file serves as an example:​
  • ​
    apiVersion: v1​
    kind: PersistentVolume​
    metadata:​
    name: pfs-static-pv # PV name. The name must be unique within the cluster.​
    spec:​
    accessModes: # PV access mode. The only supported mode is ReadWriteMany, which allows read and write access by multiple nodes.​
    - ReadWriteMany​
    capacity:​
    storage: 20Gi # The PV capacity. This is a required field in Kubernetes, but meaningless for vePFS. It is only required as a validation parameter.​
    csi:​
    driver: nas.csi.volcengine.com # Driver required for storage mount.​
    volumeAttributes:​
    fsId: vepfs ​
    fsType: vepfs # Filesystem type. Value: Extreme, Cache, Capacity, or Vepfs (indicating vePFS)​
    path: /vepfs/temp # Mount subdirectory on the filesystem. It must start with the /vepfs prefix.​
    server: export-6535d79e.cnbxxxxxbbd50f.rrazxxxxxxx7g.vepfs.ivolces.com # Mount point of the target export directory for vePFS.​
    volumeAs: subpath # The type of the subdirectory. Value: subpath (indicating a subpath) or filesystem (indicating a filesystem).​
    volumeHandle: pfs-static-pv # The unique identifier of the PV. Keep it consistent with the PV name. To use multiple PVs simultaneously, the value for each PV must be different.​
    mountOptions:​
    - nolock,proto=tcp,noresvport​
    - vers=3 # vePFS supports only v3.​
    persistentVolumeReclaimPolicy: Retain # The PV reclaim policy. Value: Retain or Delete.​
    volumeMode: Filesystem​
    ​
  1. Run the following command to create the PV.​
  • ​
    kubectl create -f vke-pfs-static-pv.yaml​
    ​
Step 2: Create a PVC​
  1. Create a YAML file for the PVC. The following vke-pfs-static-pvc.yaml file serves as an example:​
  • ​
    apiVersion: v1​
    kind: PersistentVolumeClaim​
    metadata:​
    name: pfs-static-pvc​
    namespace: default​
    spec:​
    accessModes: # PVC access method. Only ReadWriteMany is supported. ReadWriteMany allows read and write access from multiple nodes.​
    - ReadWriteMany​
    resources:​
    requests:​
    storage: 20Gi # The declared storage capacity. This is a required field in Kubernetes, but meaningless for vePFS. It is only required as a validation parameter.​
    volumeName: pfs-static-pv # The name of the PV bound to this PVC.​
    ​
  1. Run the following command to create the PVC.​
  • ​
    kubectl create -f vke-pfs-static-pvc.yaml​
    ​
  1. Run the following command to view the result of the static association between the PVC and PV.​
  • ​
    kubectl get pvc​
    ​
  • If the response is similar to the following one, the binding is successful.​
  • ​
    NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE​
    vke-pfs-static-pvc Bound vke-pfs-static-pv 20Gi RWX 2m36s​
    ​
Step 3: Create an application and mount the PV​
  1. Create a YAML file for the Deployment. The following deployment-nginx-static.yaml file serves as an example:​
  • ​
    apiVersion: apps/v1​
    kind: Deployment​
    metadata:​
    name: deployment-nginx-static​
    namespace: default​
    spec:​
    selector:​
    matchLabels:​
    app: nginx​
    template:​
    metadata:​
    labels:​
    app: nginx​
    spec:​
    containers:​
    - name: nginx​
    image: doc-cn-beijing.cr.volces.com/vke/nginx-demo:v1.0​
    ports:​
    - containerPort: 80​
    name: nginx​
    volumeMounts:​
    - name: pfs​
    mountPath: /tmp # Mount location of the PV in the container.​
    volumes:​
    - name: pfs​
    persistentVolumeClaim:​
    claimName: pfs-static-pvc # The name of the created PVC.​
    ​
  1. Run the following command to create the Deployment.​
  • ​
    kubectl apply -f deployment-nginx-static.yaml​
    ​
Using dynamically provisioned vePFS PVs​
Step 1: Create a StorageClass​
  1. Create a YAML file for the SC. The following vke-pfs-sc.yaml file serves as an example:​
  • ​
    apiVersion: storage.k8s.io/v1​
    kind: StorageClass​
    metadata:​
    name: pfs-nas-sc # Name of the StorageClass.​
    mountOptions:​
    - nolock,proto=tcp,noresvport,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2​
    - vers=3 # Protocol version for mounting the data volume. Value: 3 (indicating NFSv3)​
    parameters:​
    ChargeType: PostPaid # Billing type. It supports only PostPaid, which means pay-as-you-go.​
    fsId: vepfs # Filesystem ID. Value: vepfs​
    fsType: vepfs # Filesystem type. Value: vepfs​
    server: cngl327ffxxxxx78.3rei7p0lzu1xxxxx2j48kqtl.vepfs.ivolces.com​
    subPath: /test # The subdirectory after subPath mounting. The system will create directories within this subdirectory as the backend storage for dynamically provisioned volumes.​
    volumeAs: subpath # The type of the subdirectory. Value: subpath (indicating a subpath) or filesystem (indicating a filesystem).​
    provisioner: nas.csi.volcengine.com # Driver required for storage mount.​
    reclaimPolicy: Retain # The reclaim policy. Value: Retain or Delete.​
    volumeBindingMode: Immediate # Volume binding mode. Values include Immediate (indicating immediate binding and allocation) and WaitForFirstConsumer (indicating delayed binding and allocation).​
    ​
  1. Run the following command to create the StorageClass.​
  • ​
    kubectl create -f vke-pfs-sc.yaml​
    ​
Step 2: Create a PVC​
  1. Create a YAML file for the PVC. The following vke-pfs-dynamic-pv.yaml file serves as an example:​
  • ​
    apiVersion: v1​
    kind: PersistentVolumeClaim​
    metadata:​
    name: pfs-dynamic-pvc​
    namespace: default​
    spec:​
    accessModes: # PVC access method. Only ReadWriteMany is supported. ReadWriteMany allows read and write access from multiple nodes.​
    - ReadWriteMany​
    resources:​
    requests:​
    storage: 20Gi # The declared storage capacity. This is a required field in Kubernetes, but meaningless for vePFS. It is only required as a validation parameter.​
    storageClassName: pfs-nas-sc # Name of the created StorageClass.​
    ​
  1. Run the following command to create the PVC.​
  • ​
    kubectl create -f vke-pfs-dynamic-pvc.yaml​
    ​
  1. Run the following command to view the result of the dynamic binding between the PVC and StorageClass.​
  • ​
    kubectl get pvc​
    ​
  • If the response is similar to the following one, it indicates that the PVC and the PV are dynamically bound through the StorageClass configured by vePFS.​
  • ​
    NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS ​
    pfs-dynamic-pvc Bound pvc-6e8c646b-e3e9-4d02-836e-3b66******** 20Gi RWX pfs-nas-sc ​
    ​
Step 3: Create an application and mount the PV​
  1. Create a YAML file for the Deployment. The following deployment-nginx-dynamic.yaml file serves as an example:​
  • ​
    apiVersion: apps/v1​
    kind: Deployment​
    metadata:​
    name: deployment-nginx-dynamic​
    namespace: default​
    spec:​
    selector:​
    matchLabels:​
    app: nginx​
    template:​
    metadata:​
    labels:​
    app: nginx​
    spec:​
    containers:​
    - name: nginx​
    image: doc-cn-beijing.cr.volces.com/vke/nginx-demo:v1.0​
    ports:​
    - containerPort: 80​
    name: nginx​
    volumeMounts:​
    - name: pfs​
    mountPath: /tmp # Mount location of the PV in the container.​
    volumes:​
    - name: pfs​
    persistentVolumeClaim:​
    claimName: pfs-dynamic-pvc # The name of the created PVC.​
    ​
  1. Run the following command to create the Deployment.​
  • ​
    kubectl apply -f deployment-nginx-dynamic.yaml​
    ​
Validating results​
After creating a workload and mounting a PV to it as described in the preceding steps, you can verify the volume mounting status and persistent storage via the following methods.​
  1. Run the following command to check whether the PV is mounted to the specified path in the pod.​
  • ​
    kubectl exec vke-efs-static-deployment-xxx -- df | grep tmp​
    ​
  • The expected response is as follows.​
  • ​
    fs_vepfs-cnsh67*** 6442450944 27478016 6414972928 1% /tmp​
    ​
  1. Check the mount path in the pod to view the data in the PV.​
  • ​
    kubectl exec vke-nas-static-deployment-xxx -- ls /tmp​
    ​
  • The expected response is as follows.​
  • ​
    lost+found​
    ​
  1. Write a file to the PV.​
  • ​
    kubectl exec vke-nas-static-deployment-xxx -- touch /tmp/test​
    ​
  1. Delete the pod.​
  • ​
    kubectl delete pod vke-nas-static-deployment-xxx​
    ​
  1. Check the mount path of the PV in the newly created pod.​
  • ​
    kubectl exec vke-nas-static-deployment-xxx -- ls /tmp​
    ​
  • The expected result is as follows. You can see that the file written to the PV still exists and is not deleted along with the pod. This indicates that persistent storage of data is achieved.​
  • ​
    lost+found ​
    test​
    ​
Related documentation​
Last updated: 2026.07.24 10:53:32