All Products
Search
Document Center

File Storage NAS:Manage NAS file systems with CNFS

Last Updated:Mar 26, 2026

Container Network File System (CNFS) represents File Storage NAS file systems as Kubernetes CustomResourceDefinitions (CRDs), giving you Kubernetes-native control over file system creation, deletion, mounting, monitoring, and expansion. CNFS also improves performance and Quality of Service (QoS) for NAS file systems in your cluster.

This topic covers three ways to provision CNFS with NAS: creating a default file system, creating a custom file system, and importing an existing file system.

Limitations

  • Only Capacity NAS and Performance NAS file systems are supported. Advanced NAS and Extreme NAS file systems are not supported.

  • The CNFS reclaimPolicy only supports Retain. Deleting a CNFS resource does not delete the underlying NAS file system.

  • Default file systems are not encrypted. To enable SSE-KMS encryption, specify encryptType: SSE-KMS in the CNFS spec.

  • Activate Key Management Service (KMS) before encrypting NAS file systems. See Purchase a dedicated KMS instance.

Choose a method

Method

Description

Provisioning

Create a default NAS file system

CNFS creates a Capacity or Performance NAS file system automatically in the cluster VPC. Simplest setup.

Dynamic

Create a custom NAS file system

Specify storage type, encryption, vSwitch, and recycle bin settings.

Static or dynamic

Import an existing NAS file system

Register an existing NAS file system as a CNFS resource.

Static or dynamic

Prerequisites

Before you begin, make sure that you have:

Component

Minimum version

csi-plugin

1.20.5-ff6490f-aliyun

csi-provisioner

1.20.5-ff6490f-aliyun

storage-operator (kubectl)

1.18.8.56-2aa33ba-aliyun

storage-operator (console)

1.26.2-1de13b6-aliyun

Method 1: Create a default NAS file system

CNFS creates a Capacity or Performance NAS file system in the virtual private cloud (VPC) where the cluster is deployed. If the region does not support Capacity NAS, a Performance NAS file system is created instead.

Important

Extreme NAS file systems are not supported. The default file system is not encrypted.

kubectl

Apply the following manifests to create a CNFS resource, StorageClass, PVC, Deployment, and StatefulSet.

# 1. CNFS resource - creates a NAS file system automatically
apiVersion: storage.alibabacloud.com/v1beta1
kind: ContainerNetworkFileSystem
metadata:
  name: cnfs-nas-filesystem
spec:
  description: "cnfs"
  type: nas
  reclaimPolicy: Retain
  parameters:
    # encryptType: SSE-KMS   # Optional. Uncomment to enable KMS encryption.
    # enableTrashCan: "true"  # Optional. Uncomment to enable the recycle bin.
---
# 2. StorageClass - binds to the CNFS file system
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: alibabacloud-cnfs-nas
mountOptions:
  - nolock,tcp,noresvport
  - vers=3
parameters:
  volumeAs: subpath
  containerNetworkFileSystem: cnfs-nas-filesystem
  path: "/"
provisioner: nasplugin.csi.alibabacloud.com
reclaimPolicy: Retain
allowVolumeExpansion: true  # Optional. Set to true to enable volume expansion.
---
# 3. PVC
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: cnfs-nas-pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: alibabacloud-cnfs-nas
  resources:
    requests:
      storage: 70Gi  # With directory quota enabled, limits the writable size to 70 GiB.
---
# 4. Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cnfs-nas-deployment
  labels:
    app: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        volumeMounts:
        - mountPath: "/data"
          name: cnfs-nas-pvc
      volumes:
      - name: cnfs-nas-pvc
        persistentVolumeClaim:
          claimName: cnfs-nas-pvc
---
# 5. StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: cnfs-nas-sts
  labels:
    app: nginx
spec:
  serviceName: "nginx"
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        volumeMounts:
        - mountPath: "/data"
          name: www
  volumeClaimTemplates:
  - metadata:
      name: www
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: "alibabacloud-cnfs-nas"
      resources:
        requests:
          storage: 50Gi  # With directory quota enabled, limits the writable size to 50 GiB.

CNFS parameters

Parameter

Description

Required

Default

description

Description of the file system.

No

None

type

Volume type. Set to nas.

Yes

None

reclaimPolicy

Reclaim policy. Only Retain is supported. The NAS file system is retained when the CNFS resource is deleted.

Yes

None

parameters.encryptType

Encryption method. Valid values: None, SSE-KMS.

No

None

parameters.enableTrashCan

Whether to enable the recycle bin. Valid values: true, false.

No

false

Console

  1. Create a CNFS file system.

    1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

    2. On the Clusters page, click the name of the cluster that you want to manage. In the left-side navigation pane, choose Volumes > CNFS.

    3. On the Container Network File System (CNFS) page, click Create CNFS File System.

    4. In the Create CNFS File System panel, configure the following parameters and click OK.

      Parameter

      Description

      Example

      Name

      Name of the CNFS file system.

      cnfs-nas-filesystem

      Select File System Type

      File system type. Select NAS.

      NAS

      Required

      Select Create Default NAS File System. This field is displayed only when Select File System Type is set to NAS.

      Create Default NAS File System

      Description

      Description of the CNFS file system.

      Default NAS file system

      End-to-end Data Acceleration

      Whether to enable elastic acceleration for mounting. Disabled by default. See Enable the distributed caching feature of the CNFS client.

      Disabled

    5. On the Container Network File System (CNFS) page, click the CNFS file system name to view its details. Click the link next to the NAS ID to go to the File System List page.

    6. On the File System List page, click the Mount Targets tab. In the Mount Target list, hover over the image icon in the Mount Target column to view the mount target.

  2. Create a StorageClass.

    1. On the Clusters page, find the cluster and click its name. In the left-side pane, choose Volumes > StorageClasses.

    2. In the upper-right corner of the StorageClasses page, click Create.

    3. In the Create panel, configure the following parameters and click Create.

      Parameter

      Description

      Example

      Name

      Name of the StorageClass. Must start with a lowercase letter. Can contain lowercase letters, digits, periods (.), and hyphens (-).

      alibabacloud-cnfs-nas

      PV Type

      Volume type. Select NAS.

      NAS

      Select Mount Target

      Mount target of the NAS file system created in Step 1. See View mount targets.

      64888****-e*.cn-qingdao.nas.aliyuncs.com

      Reclaim Policy

      Reclaim policy. Only Retain is supported.

      Retain

      Mount Options

      NFS mount options. Use NFS v3. See NFS.

      nolock,tcp,noresvport vers=3

      Mount Path

      Mount path of the NAS file system.

      /

  3. Create a PVC.

    1. In the left-side navigation pane, choose Volumes > Persistent Volume Claims.

    2. In the upper-right corner, click Create.

    3. In the Create PVC panel, configure the following parameters and click Create.

      Parameter

      Description

      Example

      PVC Type

      Volume type. Select NAS.

      NAS

      Name

      PVC name. Must be unique within the cluster.

      cnfs-nas-pvc

      Allocation Mode

      Select Use StorageClass.

      Use StorageClass

      Existing Storage Class

      Click Select, find the StorageClass, and click Select in the Actions column.

      alibabacloud-cnfs-nas

      Capacity

      Capacity claimed by the PVC. Cannot exceed the PV capacity.

      70 Gi

      Access Mode

      Access mode. Default: ReadWriteMany. Also supports ReadWriteOnce and ReadOnlyMany.

      ReadWriteMany

  4. Mount the PVC to the application. Mount the NAS file system created by CNFS to the /data path in the container.

    Mount PVC to application

Method 2: Create a custom NAS file system

Specify storage type, encryption, recycle bin retention, and vSwitch when creating the NAS file system.

kubectl

  1. Create a custom NAS file system. #### CNFS parameters

    Parameter

    Description

    Required

    Default

    description

    Description of the file system.

    No

    None

    type

    Volume type. Set to nas.

    Yes

    None

    reclaimPolicy

    Reclaim policy. Only Retain is supported.

    Yes

    None

    parameters.filesystemType

    File system type. standard indicates General-purpose NAS.

    No

    standard

    parameters.storageType

    Storage type. Valid values: Performance, Capacity.

    No

    None

    parameters.protocolType

    File transfer protocol. Only NFS (NFSv3) is supported.

    No

    NFS

    parameters.encryptType

    Encryption method. Valid values: None, SSE-KMS.

    No

    None

    parameters.enableTrashCan

    Whether to enable the recycle bin. Valid values: true, false.

    No

    false

    parameters.trashCanReservedDays

    Maximum number of days files are retained in the recycle bin.

    No

    7

    parameters.vSwitchId

    vSwitch ID for the NAS file system.

    No

    None

       cat <<EOF | kubectl apply -f -
       apiVersion: storage.alibabacloud.com/v1beta1
       kind: ContainerNetworkFileSystem
       metadata:
         name: cnfs-nas-filesystem
       spec:
         description: "cnfs"
         type: nas
         reclaimPolicy: Retain
         parameters:
           filesystemType: standard
           storageType: Capacity
           protocolType: NFS
           encryptType: SSE-KMS
           enableTrashCan: "true"
           trashCanReservedDays: "5"
           vSwitchId: vsw-2ze9l3ppwzg6bl02j****
       EOF
  2. Verify the file system. Query the CNFS resource: Expected output: View file system details:

    Expected output #### Status fields

    Field

    Description

    status.status

    CNFS status. Valid values: Pending, Creating, Initialization, Available, Unavailable, Fatal, Terminating.

    conditions.lastProbeTime

    Time of the last probe.

    conditions.reason

    Reason for the current state.

    conditions.status

    Whether the file system is ready. Valid values: Ready, NotReady.

    fsAttributes.accessGroupName

    Permission group for the mount target. Value: DEFAULT_VPC_GROUP_NAME (default VPC permission group).

    fsAttributes.encryptType

    Encryption method. Valid values: None, SSE-KMS.

    fsAttributes.enableTrashCan

    Whether the recycle bin is enabled. Valid values: true, false.

    fsAttributes.filesystemId

    File system ID.

    fsAttributes.filesystemType

    File system type. standard indicates General-purpose NAS.

    fsAttributes.protocolType

    File transfer protocol.

    fsAttributes.regionId

    Region of the CNFS file system.

    fsAttributes.server

    Domain name of the mount target.

    fsAttributes.storageType

    Storage type. Valid values: Performance, Capacity.

    fsAttributes.vSwitchId

    vSwitch used by the CNFS file system.

    fsAttributes.vpcId

    VPC of the CNFS file system.

    fsAttributes.zoneId

    Zone of the CNFS file system.

       kubectl get cnfs
       NAME                  AGE
       cnfs-nas-filesystem   6d
       kubectl get cnfs/cnfs-nas-filesystem -o yaml
       apiVersion: storage.alibabacloud.com/v1beta1
       kind: ContainerNetworkFileSystem
       metadata:
         name: cnfs-nas-filesystem
       spec:
         description: "cnfs"
         type: nas
         reclaimPolicy: Retain
         parameters:
           filesystemType: standard
           storageType: Capacity
           protocolType: NFS
           encryptType: SSE-KMS
           vSwitchId: vsw-XXX
           enableTrashCan: "true"
       status:
         conditions:
         - lastProbeTime: "2021-05-14 16:20:15"
           reason: The nas filesystem and mount target complete initialization.
           status: Ready
         fsAttributes:
           accessGroupName: DEFAULT_VPC_GROUP_NAME
           encryptType: SSE-KMS
           enableTrashCan: "true"
           filesystemId: 17f7e48ece
           filesystemType: standard
           protocolType: NFS
           regionId: cn-beijing
           server: 17f7e48ece-h****.cn-beijing.nas.aliyuncs.com
           storageType: Capacity
           vSwitchId: vsw-2ze9l3ppwzg6bl02j****
           vpcId: vpc-2ze9sgmehjvwv5x74****
           zoneId: cn-beijing-h
         status: Available
  3. Create a PV or StorageClass to associate with the NAS file system. Choose one of the following options. #### Option A: Create a static PV Verify the PV: Expected output: #### Option B: Create a dynamic StorageClass

    allowVolumeExpansion enables the directory quota feature and volume expansion. Valid values: true, false.

    Parameter

    Description

    containerNetworkFileSystem

    Name of the CNFS file system.

    path

    Mount path of the NAS file system used by the PV.

       cat <<EOF | kubectl apply -f -
       apiVersion: v1
       kind: PersistentVolume
       metadata:
         name: cnfs-nas-pv
         labels:
           alicloud-pvname: cnfs-nas-pv
       spec:
         capacity:
           storage: 5Gi
         accessModes:
           - ReadWriteMany
         csi:
           driver: nasplugin.csi.alibabacloud.com
           volumeHandle: cnfs-nas-pv   # Must match the PV name.
           volumeAttributes:
             containerNetworkFileSystem: cnfs-nas-filesystem
             path: "/"
         mountOptions:
           - nolock,tcp,noresvport
           - vers=3
       EOF
       kubectl get pv
       NAME          CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE
       cnfs-nas-pv   5Gi        RWX            Retain           Available                                   4s
       cat <<EOF | kubectl apply -f -
       apiVersion: storage.k8s.io/v1
       kind: StorageClass
       metadata:
         name: alibabacloud-nas-cnfs
       mountOptions:
         - nolock,tcp,noresvport
         - vers=3
       parameters:
         volumeAs: subpath
         containerNetworkFileSystem: cnfs-nas-filesystem
         path: "/"
       provisioner: nasplugin.csi.alibabacloud.com
       reclaimPolicy: Retain
       allowVolumeExpansion: true  # Set to true to enable the directory quota feature and volume expansion.
       EOF
  4. Create a PVC.

       cat <<EOF | kubectl apply -f -
       apiVersion: v1
       kind: PersistentVolumeClaim
       metadata:
         name: cnfs-nas-pvc
       spec:
         accessModes:
           - ReadWriteMany
         storageClassName: alibabacloud-nas-cnfs
         resources:
           requests:
             storage: 70Gi
       EOF
  5. Create an application. Verify the application: Expected output: The Running status confirms that the CNFS file system is mounted to the Deployment.

       cat <<EOF | kubectl apply -f -
       apiVersion: apps/v1
       kind: Deployment
       metadata:
         name: cnfs-nas-deployment
         labels:
           app: nginx
       spec:
         selector:
           matchLabels:
             app: nginx
         template:
           metadata:
             labels:
               app: nginx
           spec:
             containers:
               - name: nginx
                 image: nginx:1.14.2
                 ports:
                   - containerPort: 80
                 volumeMounts:
                   - name: cnfs-nas-pvc
                     mountPath: "/data"
             volumes:
               - name: cnfs-nas-pvc
                 persistentVolumeClaim:
                   claimName: cnfs-nas-pvc
       EOF
       kubectl get pod
       NAME                             READY   STATUS    RESTARTS   AGE
       cnfs-nas-deployment-86959b****   1/1     Running   0          2s

Console

  1. Create a CNFS file system.

    1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

    2. On the Clusters page, click the name of the cluster that you want to manage. In the left-side navigation pane, choose Volumes > CNFS.

    3. On the Container Network File System (CNFS) page, click Create CNFS File System.

    4. In the Create CNFS File System panel, configure the following parameters and click OK.

      Parameter

      Description

      Example

      Name

      Name of the CNFS file system.

      cnfs-nas-filesystem

      Select File System Type

      File system type. Select NAS.

      NAS

      Required

      Select Select Existing NAS File System. This field is displayed only when Select File System Type is set to NAS.

      Select Existing NAS File System

      Select NAS File System

      Select an existing NAS mount target, or click Create NAS File System to create a custom General-purpose NAS file system. Displayed only when Required is set to Select Existing NAS File System. See Create a General-purpose NAS file system.

      Click Create NAS File System

      Description

      Description of the CNFS file system.

      Custom NAS file system

      End-to-end Data Acceleration

      Whether to enable elastic acceleration for mounting. Disabled by default. See Enable the distributed caching feature of the CNFS client.

      Disabled

  2. Create a PV or StorageClass to associate with the NAS file system.

    • To create a static PV:

      1. On the Clusters page, find the cluster and click its name. In the left-side pane, choose Volumes > Persistent Volumes.

      2. In the upper-right corner, click Create.

      3. In the Create PV panel, configure the following parameters and click OK.

        Parameter

        Description

        Example

        PV Type

        Volume type. Select NAS.

        NAS

        Volume Name

        PV name. Must be unique in the cluster.

        cnfs-nas-pv

        Capacity

        PV capacity. Does not limit NAS storage usage.

        5 Gi

        Access Mode

        Access mode. Default: ReadWriteMany. Also supports ReadWriteOnce.

        ReadWriteMany

        Enable CNFS

        Enable CNFS and select the CNFS file system created in Step 1. Optionally enable CNFS acceleration. See Enable the distributed caching feature of the CNFS client.

        cnfs-nas-filesystem

        Show Advanced Options

        Mount Path: Must start with a forward slash (/). If the subdirectory does not exist, the system creates it automatically. Defaults to root (/).
        Reclaim Policy: Only Retain is supported.

        / , Retain

        Label

        Labels for the PV.

        cnfs-nas-pv

    • To create a dynamic StorageClass:

      1. On the Clusters page, find the cluster and click its name. In the left-side pane, choose Volumes > StorageClasses.

      2. In the upper-right corner, click Create.

      3. In the Create panel, configure the following parameters and click Create.

        Parameter

        Description

        Example

        Name

        Name of the StorageClass. Must start with a lowercase letter. Can contain lowercase letters, digits, periods (.), and hyphens (-).

        alibabacloud-cnfs-nas

        PV Type

        Volume type. Select NAS.

        NAS

        Select Mount Target

        Mount target of the NAS file system created in Step 1. See View mount targets

        64888****-e*.cn-qingdao.nas.aliyuncs.com

        Reclaim Policy

        Reclaim policy. Only Retain is supported.

        Retain

        Mount Options

        NFS mount options. Use NFS v3. See NFS.

        nolock,tcp,noresvport vers=3

        Mount Path

        Mount path of the NAS file system.

        /

  3. Create a PVC.

    1. In the left-side navigation pane, choose Volumes > Persistent Volume Claims.

    2. In the upper-right corner, click Create.

    3. In the Create PVC panel, configure the following parameters and click Create.

      Parameter

      Description

      Example

      PVC Type

      Volume type. Select NAS.

      NAS

      Name

      PVC name. Must be unique within the cluster.

      cnfs-nas-pvc

      Allocation Mode

      Select Use StorageClass.

      Use StorageClass

      Existing Storage Class

      Click Select, find the StorageClass, and click Select in the Actions column.

      alibabacloud-cnfs-nas

      Capacity

      Capacity claimed by the PVC. Cannot exceed the PV capacity.

      70 Gi

      Access Mode

      Access mode. Default: ReadWriteMany. Also supports ReadWriteOnce and ReadOnlyMany.

      ReadWriteMany

  4. Mount the PVC to the application. Mount the NAS file system created by CNFS to the /data path in the container.

    Mount PVC to application

Method 3: Import an existing NAS file system

Register an existing NAS file system as a CNFS resource and mount it to workloads.

kubectl

  1. Create a CNFS resource from an existing NAS file system.

    Parameter

    Description

    Required

    description

    Description of the file system.

    No

    type

    Volume type. Set to nas.

    Yes

    reclaimPolicy

    Reclaim policy. Only Retain is supported.

    Yes

    parameters.server

    Mount target URL of the existing NAS file system.

    Yes

       cat <<EOF | kubectl apply -f -
       apiVersion: storage.alibabacloud.com/v1beta1
       kind: ContainerNetworkFileSystem
       metadata:
         name: cnfs-nas-filesystem
       spec:
         description: "cnfs"
         type: nas
         reclaimPolicy: Retain
         parameters:
           server: 17f7e4****-h****.cn-beijing.nas.aliyuncs.com
       EOF
  2. Verify the file system. Expected output: View file system details:

    Expected output

       kubectl get cnfs
       NAME                  AGE
       cnfs-nas-filesystem   6d
       kubectl get cnfs/cnfs-nas-filesystem -o yaml
       apiVersion: storage.alibabacloud.com/v1beta1
       kind: ContainerNetworkFileSystem
       metadata:
         name: cnfs-nas-filesystem
       spec:
         description: cnfs
         parameters:
           server: 17f7e48ece-h****.cn-beijing.nas.aliyuncs.com
         reclaimPolicy: Retain
         type: nas
       status:
         conditions:
         - lastProbeTime: "2021-05-14 16:20:15"
           reason: The nas filesystem and mount target complete initialization.
           status: Ready
         fsAttributes:
           accessGroupName: DEFAULT_VPC_GROUP_NAME
           encryptType: None
           enableTrashCan: "true"
           filesystemId: 17f7e4****
           filesystemType: standard
           protocolType: NFS
           regionId: cn-beijing
           server: 17f7e48ece-h****.cn-beijing.nas.aliyuncs.com
           storageType: Capacity
           vSwitchId: vsw-2ze9l3ppwzg6bl02j****
           vpcId: vpc-2ze9sgmehjvwv5x74****
           zoneId: cn-beijing-h
         status: Available
  3. Create a NAS volume and mount it to a workload. Follow Steps 3 through 5 in Method 2 to create a PV or StorageClass, PVC, and application.

Console

  1. Create a CNFS file system.

    1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

    2. On the Clusters page, click the name of the cluster that you want to manage. In the left-side navigation pane, choose Volumes > CNFS.

    3. On the Container Network File System (CNFS) page, click Create CNFS File System.

    4. In the Create CNFS File System panel, configure the following parameters and click OK.

      Parameter

      Description

      Example

      Name

      Name of the CNFS file system.

      cnfs-nas-filesystem

      Select File System Type

      File system type. Select NAS.

      NAS

      Required

      Select Select Existing NAS File System. This field is displayed only when Select File System Type is set to NAS.

      Select Existing NAS File System

      Select NAS File System

      Select an existing NAS mount target. See View mount targets.

      Select an existing NAS mount target

      Description

      Description of the CNFS file system.

      Existing NAS file system

      End-to-end Data Acceleration

      Whether to enable elastic acceleration for mounting. Disabled by default. See Enable the distributed caching feature of the CNFS client.

      Disabled

  2. Create a NAS volume and mount it to a workload. Follow Steps 2 through 4 in the Method 2 console instructions to create a PV or StorageClass, PVC, and mount the PVC to the application.

Next steps

Monitor NAS resource usage at the node level. See Examples of NAS file system monitoring.