Files
doc-exports/docs/cce/umn/cce_10_0620.html
qiujiandong1 218900ecfc CCE UMN 20260128 version
Reviewed-by: Gergo-Bence Lorincz <a200452876@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2026-03-11 15:13:02 +00:00

38 KiB

Using an SFS File System Through a Dynamic PV

This section describes how to use StorageClasses to dynamically create PVs and PVCs for data persistence and sharing in workloads.

Prerequisites

  • You have created a cluster and installed the CCE Container Storage (Everest) add-on in the cluster.
  • To create a cluster using commands, ensure kubectl is used. For details, see Accessing a Cluster Using kubectl.
  • Before using a general purpose file system (SFS 3.0 Capacity-Oriented) for storage, ensure a VPC endpoint has been created in the VPC where the cluster is located for the cluster to access the file system. For details, see Configure a VPC Endpoint.

Notes and Constraints

  • If a general purpose file system (SFS 3.0 Capacity-Oriented) is used, CCE Container Storage (Everest) of v2.0.9 or later must be installed in the cluster.
  • If a general purpose file system (SFS 3.0 Capacity-Oriented) is used, the owner group and permission of the mount point cannot be modified. The default owner of the mount point is user root.
  • If a general purpose file system (SFS 3.0 Capacity-Oriented) is used, there may be a latency during the creation or deletion of PVCs and PVs. The billing duration is determined by the time when the resource is created or deleted on the SFS console.

Dynamically Creating an SFS file system Using the Console

  1. Log in to the CCE console and click the cluster name to access the cluster console.
  2. Dynamically create a PVC and PV.

    1. Choose Storage in the navigation pane. In the right pane, click the PVCs tab. Click Create PVC in the upper right corner. In the dialog box displayed, configure PVC parameters.

      Parameter

      Description

      PVC Type

      In this example, select SFS.

      PVC Name

      Enter the PVC name, which must be unique in a namespace.

      Creation Method

      • If no underlying storage is available, select Dynamically provision to create a PVC, PV, and underlying storage on the console in cascading mode.
      • If underlying storage is available, create a PV or use an existing PV to statically create a PVC. For details, see Using an Existing SFS File System Through a Static PV.

      In this example, select Dynamically provision.

      Storage Classes

      The default StorageClass of SFS volumes is csi-nas.

      You can customize a StorageClass and configure its reclaim policy and binding mode. For details, see Creating a StorageClass Through the Console.

      (Optional) Storage Volume Name Prefix

      Available only when the cluster version is v1.23.14-r0, v1.25.9-r0, v1.27.6-r0, v1.28.4-r0, or later, and Everest v2.4.15 or later is installed in the cluster.

      This parameter specifies the name of the underlying storage that is automatically created. The actual underlying storage name is in the format of "Storage volume name prefix + PVC UID". If this parameter is left blank, the default prefix pvc will be used.

      For example, if the storage volume name prefix is set to test, the actual underlying storage name is test-{UID}.

      Access Mode

      SFS volumes support only ReadWriteMany, indicating that a storage volume can be mounted to multiple nodes in read/write mode. For details, see Volume Access Modes.

    2. Click Create to create a PVC and a PV.

      You can choose Storage in the navigation pane and view the created PVC and PV on the PVCs and PVs tabs, respectively.

  3. Create an application.

    1. Choose Workloads in the navigation pane. In the right pane, click the Deployments tab.
    2. Click Create Workload in the upper right corner. On the displayed page, click Data Storage in the Container Information area under Container Settings and choose Add Volume > PVC.
      Mount and use storage volumes. For details about the parameters, see Table 1. For other parameters, see Workloads.
      Table 1 Mounting a storage volume

      Parameter

      Description

      PVC

      Select an existing SFS volume.

      Mount Path

      Enter a mount path, for example, /tmp.

      This parameter specifies a container path to which a data volume will be mounted. Do not mount the volume to a system directory such as / or /var/run. This may lead to container errors. Mount the volume to an empty directory. If the directory is not empty, ensure that there are no files that affect container startup. Otherwise, the files will be replaced, leading to container startup failures or workload creation failures.
      NOTICE:

      If a volume is mounted to a high-risk directory, use an account with minimum permissions to start the container. Otherwise, high-risk files on the host may be damaged.

      Subpath

      Enter the subpath of the storage volume and mount a path in the storage volume to the container. In this way, different folders of the same storage volume can be used in a single pod. tmp, for example, indicates that data in the mount path of the container is stored in the tmp folder of the storage volume. If this parameter is left blank, the root path will be used by default.

      Permission

      • Read-only: You can only read the data in the mounted volumes.
      • Read-write: You can modify the data volumes mounted to the path. Newly written data will not be migrated if the container is migrated, which may cause data loss.

      In this example, the disk is mounted to the /data path of the container. The container data generated in this path is stored in the SFS file system.

    3. After the configuration, click Create Workload.

      After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence and Sharing.

Dynamically Creating an SFS File System Using kubectl

  1. Use kubectl to access the cluster.
  2. Use StorageClass to dynamically create a PVC and PV.

    1. Create the pvc-sfs-auto.yaml file.
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: pvc-sfs-auto
        namespace: default
        annotations: 
      
      
      
          everest.io/csi.volume-name-prefix: test  # (Optional) Storage volume name prefix of the automatically created underlying storage
      spec:
        accessModes:
          - ReadWriteMany             # The value must be ReadWriteMany for SFS.
        resources:
          requests:
            storage: 1Gi             # SFS volume capacity
        storageClassName: csi-nas    # The StorageClass is SFS. csi-sfs indicates that a general purpose file system (SFS 3.0 Capacity-Oriented) is used.
      Table 2 Key parameters

      Parameter

      Mandatory

      Description

      storage

      Yes

      Requested capacity in the PVC, in Gi.

      For SFS, this parameter is only for verification. It must not be empty or 0, and its value is fixed at 1. Any value you set will not take effect.

      everest.io/crypt-key-id

      No

      If the StorageClass is csi-nas, you can determine whether to encrypt the underlying storage.

      This parameter is mandatory when an SFS system is encrypted. Enter the encryption key ID selected during SFS system creation. You can use a custom key or the default key named sfs/default.

      To obtain a key ID, log in to the DEW console, locate the key to be encrypted, and copy the key ID.

      everest.io/crypt-alias

      No

      Key name, which is mandatory when you create an encrypted volume.

      To obtain a key name, log in to the DEW console, locate the key to be encrypted, and copy the key name.

      everest.io/crypt-domain-id

      No

      ID of the tenant to which the encrypted volume belongs. This parameter is mandatory for creating an encrypted volume.

      To obtain a tenant ID, hover the cursor over the username in the upper right corner of the ECS console, choose My Credentials, and copy the account ID.

      everest.io/csi.volume-name-prefix

      No

      (Optional) This parameter is available only when the cluster version is v1.23.14-r0, v1.25.9-r0, v1.27.6-r0, v1.28.4-r0, or later, and Everest v2.4.15 or later is installed in the cluster.

      This parameter specifies the name of the underlying storage that is automatically created. The actual underlying storage name is in the format of "Storage volume name prefix + PVC UID". If this parameter is left blank, the default prefix pvc will be used.

      Enter 1 to 26 characters that cannot start or end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

      For example, if the storage volume name prefix is set to test, the actual underlying storage name is test-{UID}.

    2. Run the following command to create a PVC:
      kubectl apply -f pvc-sfs-auto.yaml

  3. Create an application.

    1. Create a file named web-demo.yaml. In this example, the SFS volume is mounted to the /data path.
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: web-demo
        namespace: default
      spec:
        replicas: 2
        selector:
          matchLabels:
            app: web-demo
        template:
          metadata:
            labels:
              app: web-demo
          spec:
            containers:
            - name: container-1
              image: nginx:latest
              volumeMounts:
              - name: pvc-sfs-volume    # Volume name, which must be the same as the volume name in the volumes field
                mountPath: /data  # Location where the storage volume is mounted
            imagePullSecrets:
              - name: default-secret
            volumes:
              - name: pvc-sfs-volume    # Volume name, which can be customized
                persistentVolumeClaim:
                  claimName: pvc-sfs-auto    # Name of the created PVC
    2. Run the following command to create a workload to which the SFS volume is mounted:
      kubectl apply -f web-demo.yaml

      After the workload is created, the data in the container mount directory will be persistently stored. Verify the storage by referring to Verifying Data Persistence and Sharing.

Verifying Data Persistence and Sharing

  1. View the deployed application and files.

    1. Run the following command to view the created pod:
      kubectl get pod -n <namespace> | grep web-demo
      Expected output:
      web-demo-846b489584-mjhm9   1/1     Running   0             46s
      web-demo-846b489584-wvv5s   1/1     Running   0             46s
    2. Run the following commands in sequence to check the files in the /data path of the pods:
      kubectl exec -n <namespace> web-demo-846b489584-mjhm9 -- ls /data
      kubectl exec -n <namespace> web-demo-846b489584-wvv5s -- ls /data

      If no result is returned for both pods, no file exists in the /data path.

  2. Run the following command to create a file named static in the /data path:

    kubectl exec -n <namespace> web-demo-846b489584-mjhm9 --  touch /data/static

  3. Run the following command to check the files in the /data path:

    kubectl exec -n <namespace> web-demo-846b489584-mjhm9 -- ls /data

    Expected output:

    static

  4. Verify data persistence.

    1. Run the following command to delete the pod named web-demo-846b489584-mjhm9:
      kubectl delete pod -n <namespace> web-demo-846b489584-mjhm9

      Expected output:

      pod "web-demo-846b489584-mjhm9" deleted

      After the deletion, the Deployment controller automatically creates a replica.

    2. Run the following command to view the created pod:
      kubectl get pod -n <namespace> | grep web-demo
      The expected output is as follows, in which web-demo-846b489584-d4d4j is the newly created pod:
      web-demo-846b489584-d4d4j   1/1     Running   0             110s
      web-demo-846b489584-wvv5s    1/1     Running   0             7m50s
    3. Run the following command to check whether the files in the /data path of the new pod have been modified:
      kubectl exec -n <namespace> web-demo-846b489584-d4d4j -- ls /data

      Expected output:

      static

      The static file is retained, indicating that the data in the file system can be stored persistently.

  5. Verify data sharing.

    1. Run the following command to view the created pod:
      kubectl get pod -n <namespace> | grep web-demo
      Expected output:
      web-demo-846b489584-d4d4j   1/1     Running   0             7m
      web-demo-846b489584-wvv5s   1/1     Running   0             13m
    2. Run the following command to create a file named share in the /data path of either pod: In this example, select the pod named web-demo-846b489584-d4d4j.
      kubectl exec -n <namespace> web-demo-846b489584-d4d4j --  touch /data/share
      Check the files in the /data path of the pod.
      kubectl exec -n <namespace> web-demo-846b489584-d4d4j -- ls /data

      Expected output:

      share
      static
    3. Check whether the share file exists in the /data path of another pod (web-demo-846b489584-wvv5s) as well to verify data sharing.
      kubectl exec -n <namespace> web-demo-846b489584-wvv5s -- ls /data

      Expected output:

      share
      static

      After you create a file in the /data path of a pod, if the file is also created in the /data path of the other pod, the two pods share the same volume.

Related Operations

You can also perform the operations listed in Table 3.
Table 3 Related operations

Operation

Description

Procedure

Viewing events

View event names, event types, number of occurrences, Kubernetes events, first occurrence time, and last occurrence time of the PVC or PV.

  1. Choose Storage in the navigation pane. In the right pane, click the PVCs or PVs tab.
  2. Click View Events in the Operation column of the target PVC or PV to view events generated within one hour (events are retained for one hour).

Viewing a YAML file

View, copy, or download the YAML file of a PVC or PV.

  1. Choose Storage in the navigation pane. In the right pane, click the PVCs or PVs tab.
  2. Click View YAML in the Operation column of the target PVC or PV to view or download the YAML.

Editing Reclaim Policy

Modify the reclaim policy of a PV.

  1. In the navigation pane, choose Storage. Then click the PVs tab.
  2. Locate the row containing the target PV and choose More > Edit Reclaim Policy.

Synchronizing PVC capacity (supported only for PVCs created from non-subdirectories of SFS Capacity-Oriented file systems)

When the underlying storage outgrows the PVC, resize the PVC capacity on the CCE console to match the new size.

  1. In the navigation pane, choose Storage. Then, click the PVCs tab.
  2. Locate the target PVC and click Synchronize in the Capacity column to make the PVC capacity consistent with the underlying storage capacity.

    Synchronize is only displayed when the underlying storage capacity is greater than the PVC capacity.