Local File System
Creating a StorageClass
Prepare a StorageClass configuration file, for example, mysc.yaml. For details about the StorageClass configuration, see the following example.
Run the following command to create a StorageClass using the configuration file.
kubectl apply -f mysc.yamlRun the following command to view the information about the created StorageClass.
kubectl get sc myscThe 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
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. | |||||
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. | |||||
Reclamation policy. The following types are supported: Delete: Resources are automatically reclaimed. Retain: Resources are manually reclaimed. | 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. | ||||
Whether to allow volume expansion. If this parameter is set to true, the capacity of the PV that uses the StorageClass can be expanded. | This function can only be used to expand PV capacity but cannot be used to reduce PV capacity. | ||||
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. | For details about common parameters in mountOptions, see Table 2. | ||||
Name of the backend where the resource to be created is located. This field must be set if parameters.pool is set. | When creating a KV cache in the local file system of iMaster DME, you need to specify the backend to be used. | ||||
Name of the storage resource pool where the resource to be created is located. | 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. | ||||
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. | |||||
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 }} | 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. | ||||
Type of the volume to be created. The following types are supported: | |||||
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". | |||||
Description of the file system to be created. Value type: string; length limit: 1 to 255 characters. | |||||
Whether to create a KV cache store. The options include "false" (disabled) and "true" (enabled). | This parameter must be set to true when a single-zone resource is created in the current scenario. | ||||
Whether to enable proactive clearing for a KV cache. The options include "false" (disabled) and "true" (enabled). | 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. | ||||
KV cache expiration time. The value ranges from 1 to 3650 days. Example: 1 | This parameter is mandatory when parameters.enableTimeAwareGc is set to "true". |
Table 2 Common parameters in mountOptions