The Elastic File Client (EFC) supports high-concurrency and large-scale parallel data access, making it a strong fit for data-intensive containerized workloads such as big data analytics, AI training, and inference. Compared to the traditional Network File System (NFS) protocol, EFC delivers significantly improved I/O performance and lower latency. This topic explains how to mount a NAS file system using EFC through the Container Network File System (CNFS).
EFC requires nodes running Alibaba Cloud Linux 3 or ContainerOS with kernel version 5.10.134-17.2 or later. Nodes that do not meet these requirements automatically fall back to the NFS protocol for mounting. Verify node compatibility before proceeding.
How EFC works
EFC is a user-space, POSIX-compliant client built on FUSE (Filesystem in Userspace). It replaces kernel-mode NFS clients and provides core capabilities:
Multi-connection access
Metadata and data caching
Integrated monitoring via Managed Service for Prometheus
Compared to kernel-mode NFS clients:
Capability | Description |
Strong data consistency | Files and directories stay consistent through a distributed locking mechanism. Written files are immediately visible to all other clients, and newly created files sync across nodes instantly. |
Single-node read/write caching | EFC caches data in a portion of compute node memory, improving small-file throughput and delivering over 50% I/O performance gains versus traditional NFS clients. |
Small file prefetching | Automatically identifies and prefetches hot directories and files to reduce data-pull overhead. |
Hot upgrade and failover | Client updates apply without restarting applications. If the client fails, automatic failover prevents service interruption. |
Prerequisites
Before you begin, ensure that you have:
The
cnfs-nas-daemonadd-on installed in your cluster, with theAlinasMountProxy=trueflag set in the FeatureGate of the csi-plugin. See Manage cnfs-nas-daemon for details.Nodes running Alibaba Cloud Linux 3 or ContainerOS, with kernel version 5.10.134-17.2 or later.
Configure CNFS to use the EFC client
Step 1: Create a CNFS resource
This section shows how to configure an existing NAS file system to use the EFC client. To create a new NAS file system through CNFS with EFC, add useClient: EFCClient in the parameters section when creating the ContainerNetworkFileSystem resource. See Use CNFS to manage NAS file systems (recommended) for details.
Save the following YAML as
cnfs-efc.yaml.Parameter
Description
descriptionA description for the file system.
typeThe volume type. Set to
nasfor NAS file systems.reclaimPolicyOnly
Retainis supported. Deleting the CNFS resource does not delete the underlying NAS file system.serverThe mount target address. The mount target must be in the same VPC as your pods and its status must be Ready. For best performance, use the same vSwitch for both the mount target and pods. If no existing mount target meets these requirements, create a new one.
useClientSet to
EFCClientto enable the EFC client.apiVersion: storage.alibabacloud.com/v1beta1 kind: ContainerNetworkFileSystem metadata: name: cnfs-efc-test spec: description: "cnfs" type: nas reclaimPolicy: Retain parameters: server: 17f7e4****-h****.cn-beijing.nas.aliyuncs.com useClient: EFCClientCreate the CNFS resource:
kubectl create -f cnfs-efc.yaml
Step 2: Create a PersistentVolume and PersistentVolumeClaim
Save the following YAML as cnfs-pv-pvc.yaml.
apiVersion: v1
kind: PersistentVolume
metadata:
name: efc-pv
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 50Gi
claimRef:
name: efc-pvc
namespace: default
csi:
driver: nasplugin.csi.alibabacloud.com
volumeAttributes:
containerNetworkFileSystem: cnfs-efc-test
path: /
volumeHandle: efc-pv
volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efc-pvc
namespace: default
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
storageClassName: ""
volumeMode: Filesystem
volumeName: efc-pvApply the configuration:
kubectl create -f cnfs-pv-pvc.yamlMount NAS to a workload
Step 1: Create a Deployment
Save the following YAML as cnfs-deployment.yaml.
apiVersion: apps/v1
kind: Deployment
metadata:
name: efc-test
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: efc-test
template:
metadata:
labels:
app: efc-test
spec:
containers:
- command:
- sh
- -c
- |
sleep infinity
image: alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest
name: test
volumeMounts:
- mountPath: /mnt
name: pvc
volumes:
- name: pvc
persistentVolumeClaim:
claimName: efc-pvcApply the configuration:
kubectl create -f cnfs-deployment.yamlStep 2: Verify the EFC mount
Check that the pod is running:
kubectl get pod -l app=efc-testExpected output:
NAME READY STATUS RESTARTS AGE efc-test-f545b86d6-spr7p 1/1 Running 0 29mOnce the pod reaches the Running state, confirm the EFC mount point inside the pod:
kubectl exec <pod-name> -- mount -t fuse.aliyun-alinas-efcExpected output:
bindroot-3889a-8TzEY5mc:3d2804****-w****.cn-shanghai.nas.aliyuncs.com:/ on /mnt type fuse.aliyun-alinas-efc (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=1048576)The mount type
fuse.aliyun-alinas-efcconfirms EFC is active. If the output showsnfsinstead, the node does not meet the OS or kernel requirements and has fallen back to the NFS protocol. Check the node OS version and kernel version against the prerequisites.
What's next
Use CNFS to manage NAS file systems — manage NAS file systems through CNFS, including dynamic provisioning for new file systems.
Manage cnfs-nas-daemon — install and configure the
cnfs-nas-daemonadd-on and theAlinasMountProxyfeature gate.