File System
Creating a StorageClass
Prepare a StorageClass configuration file, for example, msc .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.yaml
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
NFS Protocol Configuration Example
When a container uses the NFS protocol to connect to file system resources, refer to the following StorageClass configuration example. In this example, NFS version 4.0 is specified for mounting.
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: mysc
provisioner: csi.huawei.com
parameters:
backend: nfs-nas-181
pool: StoragePool001
volumeType: fs
allocType: thin
authClient: "*"
mountOptions:
- nfsvers=4.0 # Specify the version 4.0 for NFS mounting.
StorageClass Parameters Supported by File Systems
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: | |||||
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. | If this parameter is not set, Huawei CSI will randomly select a backend that meets the capacity requirements to create resources. You are advised to specify a backend to ensure that the created resource is located on the expected backend. | ||||
Name of the storage resource pool where the resource to be created is located. | If this parameter is not set, Huawei CSI will randomly select a storage pool that meets the capacity requirements 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. | ||||
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: namespace. PVC name: pvc-1. PVC UID: c2fd3f46-bf17-4a7d-b88e-2e3232bae434. volumeName is set to prefix-{{ .PVCNamespace }}_{{ .PVCName }}. The ultimate storage resource name is prefix-namespace_pvc-1-c2fd3f46bf174a7db88e2e3232bae434. | ||||
Type of the volume to be created. The following types are supported: | |||||
Allocation type of the volume to be created. The following types are supported: | If this parameter is set to thin, the required space is not allocated immediately when a volume is created. Instead, the space is dynamically allocated based on the usage. | ||||
IP address of the NFS client that can access the volume. You can enter the client host name (a full domain name is recommended), client IP address, or client IP address segment. | The asterisk (*) can be used to indicate any client. If you are not sure about the IP address of the access client, you are advised to use the asterisk (*) to prevent the client access from being rejected by the storage system. If the client host name is used, you are advised to use the full domain name. The IP addresses can be IPv4 addresses, IPv6 addresses, or a combination of IPv4 and IPv6 addresses. You can enter multiple host names, IP addresses, or IP address segments and separate them with semicolons (;). Example: 192.168.0.10;192.168.0.0/24;myserver1.test | ||||
4 indicates the highest speed. This parameter takes effect when a PV is cloned or a PV is created using a snapshot. | |||||
Log in to DeviceManager and choose Services > File Service > File Systems > Create to obtain the application type name. | |||||
QoS settings of the file system on the storage side of the PV. The value of the parameter is JSON character strings in dictionary format. A character string is enclosed by single quotation marks and the dictionary key by double quotation marks. Example: '{"maxMBPS": 999, "maxIOPS": 999}' | For details about the supported QoS configurations, see Table 3. | ||||
For details about the configuration format, refer to the Linux permission settings, for example, 777 and 755. | |||||
Controls the root permission of the client. | |||||
Whether to retain the user ID (UID) and group ID (GID) of a shared directory. | |||||
Configures the krb5 security protocol. | During mounting, you can specify the sec parameter in mountOptions. | ||||
Configures the krb5i security protocol. | During mounting, you can specify the sec parameter in mountOptions. | ||||
Configures the krb5p security protocol. | During mounting, you can specify the sec parameter in mountOptions. | ||||
Whether the snapshot directory is visible. | |||||
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.
| |||||
Advanced volume creation parameters. The value of the parameter is JSON character strings in dictionary format. A character string is enclosed by single quotation marks and the dictionary key by double quotation marks. Example: '{"CAPACITYTHRESHOLD": 90}' | For details about the supported advanced parameters, see Table 4. |
Table 2 Common parameters in mountOptions
Table 3 Supported QoS configurations
Table 4 Supported advanced volume creation parameters
For details about the default value and value range, see the corresponding storage product manual. |