Updated on 2024-01-29 GMT+08:00

(kubectl) Automatically Creating an SFS Volume

Currently, SFS file systems are sold out and PVCs cannot be automatically created using the storage class.

Notes and Constraints

The following configuration example applies to clusters of Kubernetes 1.13 or earlier.

Procedure

  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: 
      annotations: 
        volume.beta.kubernetes.io/storage-class: nfs-rw
      name: pvc-sfs-auto-example 
      namespace: default 
    spec: 
      accessModes: 
      - ReadWriteMany 
      resources: 
        requests: 
          storage: 10Gi
    Table 1 Key parameters

    Parameter

    Description

    volume.beta.kubernetes.io/storage-class

    File storage class. Currently, the standard file protocol type (nfs-rw) is supported.

    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 log in to the SFS console to view the file system.