全部產品
Search
文件中心

Apsara File Storage NAS:建立CNFS管理NAS檔案系統

更新時間:Jul 06, 2024

容器網路檔案系統CNFS(Container Network File System)將阿里雲的檔案儲存體抽象為一個K8s對象(CRD)進行獨立管理,包括建立、刪除、描述、掛載、監控及擴容等營運操作。您可以通過CNFS建立一個新的NAS檔案系統或管理已存在的NAS檔案系統,以提升NAS檔案系統的效能和QoS控制,實現對檔案系統層的獨立管理。本文介紹如何建立CNFS來管理NAS檔案系統。

前提條件

操作步驟

您可以通過以下兩種方式使用CNFS管理NAS檔案系統。

方式一:使用CNFS管理建立的NAS檔案系統

  1. 執行以下命令,使用CNFS建立並管理通用容量型NAS的檔案儲存體。

    說明
    • 通用容量型NAS免費建立,按實際資料量收費。更多資訊,請參見計費概述

    • 資源回收筒功能本身不收取任何費用,但是暫存在資源回收筒中的檔案將按照刪除前的儲存類型收取儲存費用。更多資訊,請參見資源回收筒

    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      # 容量型NAS。
        protocolType: NFS
        encryptType: None
        enableTrashCan: "true"     # 資源回收筒開啟。
        trashCanReservedDays: "5"  # 資源回收筒中資料保留5天。
    EOF
  2. 執行以下命令,查看CNFS管理的NAS檔案系統。

    kubectl get cnfs cnfs-nas-filesystem -oyaml

    預期輸出:

    展開查看預期輸出

    apiVersion: storage.alibabacloud.com/v1beta1
    kind: ContainerNetworkFileSystem
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"storage.alibabacloud.com/v1beta1","kind":"ContainerNetworkFileSystem","metadata":{"annotations":{},"name":"cnfs-nas-filesystem"},"spec":{"description":"cnfs","parameters":{"enableTrashCan":"true","encryptType":"None","filesystemType":"standard","protocolType":"NFS","storageType":"Capacity","trashCanReservedDays":"5"},"reclaimPolicy":"Retain","type":"nas"}}
      creationTimestamp: "2022-12-14T13:09:59Z"
      finalizers:
      - protection.alibabacloud.com/cnfs
      generation: 6
      name: cnfs-nas-filesystem
      resourceVersion: "20362768"
      uid: f70edfc7-2760-4304-a693-a682bfc1****
    spec:
      description: cnfs
      parameters:
        enableTrashCan: "true"
        encryptType: None
        filesystemType: standard
        protocolType: NFS
        storageType: Capacity
        trashCanReservedDays: "5"
      reclaimPolicy: Retain
      type: nas
    status:
      conditions:
      - lastProbeTime: "2022-12-14 21:10:33"
        reason: The nas filesystem and mount target complete initialization.
        status: Ready
      fsAttributes:
        accessGroupName: DEFAULT_VPC_GROUP_NAME
        enableTrashCan: "true"
        encryptType: None
        filesystemId: 971134b0e8
        filesystemType: standard
        protocolType: NFS
        regionId: cn-zhangjiakou
        server: 971134b0e8-****.cn-zhangjiakou.nas.aliyuncs.com
        storageType: Capacity
        trashCanReservedDays: "5"
        useClient: "NFSClient"
        vSwitchId: vsw-8vb4m54nru36mdv2s****
        vpcId: vpc-8vbv553d3rdcwwin3****
      status: Available

方式二:使用CNFS管理已有的NAS檔案系統

說明

使用CNFS管理已有NAS檔案系統,需要確保已有的NAS檔案系統已經在ACK所在VPC內擁有掛載點。關於如何查看掛載點地址,請參見查看掛載點地址

  1. 執行以下命令,將NAS檔案系統納入CNFS託管。

    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: 971134b0e8-****.cn-zhangjiakou.nas.aliyuncs.com # NAS檔案系統的掛載點。
    EOF
  2. 執行以下命令,查看CNFS管理的NAS檔案系統。

    kubectl get cnfs cnfs-nas-filesystem -oyaml

    預期輸出:

    展開查看預期輸出

    apiVersion: storage.alibabacloud.com/v1beta1
    kind: ContainerNetworkFileSystem
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          {"apiVersion":"storage.alibabacloud.com/v1beta1","kind":"ContainerNetworkFileSystem","metadata":{"annotations":{},"name":"cnfs-nas-filesystem"},"spec":{"server: 971134b0e8-jsg4.cn-zhangjiakou.nas.aliyuncs.com"}}}
      creationTimestamp: "2022-12-14T13:09:59Z"
      finalizers:
      - protection.alibabacloud.com/cnfs
      generation: 6
      name: cnfs-nas-filesystem
      resourceVersion: "20362768"
      uid: f70edfc7-2760-4304-a693-a682bfc1****
    spec:
      description: cnfs
      parameters:
        server: 971134b0e8-****.cn-zhangjiakou.nas.aliyuncs.com
      reclaimPolicy: Retain
      type: nas
    status:
      conditions:
      - lastProbeTime: "2022-12-14 21:10:33"
        reason: The nas filesystem and mount target complete initialization.
        status: Ready
      fsAttributes:
        accessGroupName: DEFAULT_VPC_GROUP_NAME
        enableTrashCan: "true"
        encryptType: None
        filesystemId: 971134b0e8
        filesystemType: standard
        protocolType: NFS
        regionId: cn-zhangjiakou
        server: 971134b0e8-****.cn-zhangjiakou.nas.aliyuncs.com
        storageType: Capacity
        trashCanReservedDays: "5"
        useClient: "NFSClient"
        vSwitchId: vsw-8vb4m54nru36mdv2s****
        vpcId: vpc-8vbv553d3rdcwwin3x****
      status: Available

相關文檔