Local File System

Creating a StorageClass

  1. Prepare a StorageClass configuration file, for example, mysc.yaml. For details about the StorageClass configuration, see the following example.

  2. Run the following command to create a StorageClass using the configuration file.

    kubectl apply -f mysc.yaml
    
  3. Run the following command to view the information about the created StorageClass.

    kubectl get sc mysc
    

    The following is an example of the command output.

    NAME   PROVISIONER      RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
    mysc   csi.huawei.com   Delete          Immediate           true                   8s
    

KV Cache Configuration Example

If the container uses KV cache to connect to the iMaster DME local file system and the storage system supports KV cache, refer to the following configuration example.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: kvcache-nas-sc
provisioner: csi.huawei.com
reclaimPolicy: Delete
parameters:
  backend: dme-a800-backend
  pool: StoragePool001
  zoneVstoreName: System_vstore
  volumeType: fs
  enableKVCache: "true"
  enableTimeAwareGc: "true"
  gcTimeThreshold: "30"
  disableVerifyCapacity: "true"
mountOptions:
  - nfsvers=3 # Specify the version 3 for NFS mounting.

Table 1 StorageClass configuration parameters

Parameter

Description

Mandatory

Default Value

Whether the Volume Management Takes Effect

Remarks

metadata.name

User-defined name of a StorageClass object.

Yes

-

Yes

Take Kubernetes v1.22.1 as an example. The value can contain digits, lowercase letters, hyphens (-), and periods (.), and must start and end with a letter or digit.

provisioner

Name of the provisioner.

Yes

csi.huawei.com

Yes

Set this parameter to the driver name set during Huawei CSI installation. The value is the same as that of driverName in the values.yaml file.

reclaimPolicy

Reclamation policy. The following types are supported: Delete: Resources are automatically reclaimed. Retain: Resources are manually reclaimed.

No

Delete

Yes

Delete: When a PV/PVC is deleted, resources on the storage device are also deleted. Retain: When a PV/PVC is deleted, resources on the storage device are not deleted. Note: When a KV cache resource is deleted, the file system share is also deleted.

allowVolumeExpansion

Whether to allow volume expansion. If this parameter is set to true, the capacity of the PV that uses the StorageClass can be expanded.

No

false

Yes

This function can only be used to expand PV capacity but cannot be used to reduce PV capacity.

mountOptions

List of mount parameters, which can be used to specify the parameters of the -o option when the mount command is executed on a host.

No

-

Yes

For details about common parameters in mountOptions, see Table 2.

You can also specify other mount parameters.

parameters.backend

Name of the backend where the resource to be created is located. This field must be set if parameters.pool is set.

Yes

-

No

When creating a KV cache in the local file system of iMaster DME, you need to specify the backend to be used.

parameters.pool

Name of the storage resource pool where the resource to be created is located.

No

-

No

If this parameter is not set, Huawei CSI will select a storage pool with the largest remaining capacity from the selected backend to create resources. You are advised to specify a storage pool to ensure that the created resource is located in the expected storage pool.

parameters.zoneVstoreName

vStore name of the storage device.

No

System_vStore

No

This parameter is valid only when a zone SN is specified. On the iMaster DME, choose Infrastructure > Storage Devices > System > vStores. Obtain the name of a non-global vStore in the corresponding zone.

parameters.volumeName

Name of the storage resource created by dynamic volume provisioning. You can configure a placeholder to customize the storage resource name. The following placeholders are supported: PVC namespace: {{ .PVCNamespace }}; PVC name: {{ .PVCName }}

No

-

No

The value can contain letters, digits, underscores (_), and hyphens (-). It cannot be left empty. The name length of the generated storage resource ranges from 1 to 255 characters. Both the PVC namespace and PVC name must be configured. To avoid duplicate resource names, the PVC UID is added to the end of the name as a unique identifier by default.

parameters.volumeType

Type of the volume to be created. The following types are supported:

  • lun: A LUN is provisioned on the storage side.
  • fs: A file system is provisioned on the storage side.
  • dtree: A volume of the dtree type is provisioned on the storage side.

Yes

-

Yes

To use the file service, you must set this parameter to fs.

parameters.disableVerifyCapacity

Whether to disable volume capacity verification. After this function is disabled, the system will not verify whether the volume capacity is an integer multiple of the sector size. The value can be "true" (disables volume capacity verification) or "false" (enables volume capacity verification). When Red Hat OpenShift Virtualization is used to connect to CSI, this parameter must be set to "true".

No

"true"

Yes

The sector size of OceanStor A series is 512 bytes.

parameters.description

Description of the file system to be created. Value type: string; length limit: 1 to 255 characters.

No

Created from Kubernetes CSI

No

  

parameters.enableKVCache

Whether to create a KV cache store. The options include "false" (disabled) and "true" (enabled).

Yes

"false"

No

This parameter must be set to true when a single-zone resource is created in the current scenario.

parameters.enableTimeAwareGc

Whether to enable proactive clearing for a KV cache. The options include "false" (disabled) and "true" (enabled).

No

"false"

No

No matter whether this parameter is set to "true" or "false", the background clears the KV cache when the memory store capacity is insufficient. When this parameter is set to "true", the background clears the expired KV cache.

parameters.gcTimeThreshold

KV cache expiration time. The value ranges from 1 to 3650 days. Example: 1

Conditionally mandatory

-

No

This parameter is mandatory when parameters.enableTimeAwareGc is set to "true".

Table 2 Common parameters in mountOptions

Parameter

Description

Mandatory

Default Value

Remarks

mountOptions.nfsvers

NFS mount option on the host. The following mount option is supported:

nfsvers: protocol version for NFS mounting. The value can be 3, 4, 4.0, 4.1, or 4.2.

No

-

This parameter is optional after the -o parameter when the mount command is executed on the host. The value is in list format.

If the NFS version is specified for mounting, NFS 3, 4.0, 4.1, and 4.2 protocols are supported (the protocol must be supported and enabled on storage devices). If nfsvers is set to 4, the latest protocol version NFS 4 may be used for mounting due to different OS configurations, for example, 4.2. If the 4.0 protocol is required, you are advised to set nfsvers to 4.0.