Help Center> Cloud Container Engine> User Guide> Old Console> Storage (CSI)> SFS Volumes> (kubectl) Automatically Creating an SFS Volume

(kubectl) Automatically Creating an SFS Volume

Scenario

CCE supports creating SFS volumes through PersistentVolumeClaims (PVCs).

Prerequisites

You have created a CCE cluster and installed the CSI plug-in (everest) in the cluster.

Notes and Constraints

The following configuration example applies to clusters of Kubernetes 1.15 or later.

Procedure

SFS file systems have been sold out and cannot be automatically created.

  1. Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
  2. Run the following commands to configure the pvc-sfs-auto-example.yaml file, which is used to create a PVC.

    touch pvc-sfs-auto-example.yaml

    vi pvc-sfs-auto-example.yaml

    Example YAML file:
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name:  pvc-sfs-auto-example
      namespace: default
    spec:
      accessModes:
      - ReadWriteMany
      resources:
        requests:
          storage: 10Gi
      storageClassName: csi-nas
    Table 1 Key parameters

    Parameter

    Description

    storageClassName

    Name of the Kubernetes storage class. Set this field to csi-nas.

    name

    Name of the PVC to be created.

    accessModes

    Only ReadWriteMany is supported. ReadWriteOnly is not supported.

    storage

    Storage capacity in the unit of Gi.

  3. Run the following command to create a PVC.

    kubectl create -f pvc-sfs-auto-example.yaml

    After the command is executed, a file system is created in the VPC to which the cluster belongs. Choose Storage > SFS on the CCE console or switch to the SFS console to view the file system.