Creating a Storage Backend
Prerequisites
- You have obtained the management IP address, username, and password of the storage device.
- You have obtained configuration information such as the storage pool name and storage protocol. For details about the configuration items, see section Configuring the Storage Backend .
Procedure
Prepare the secret configuration file, for example, backend-secret.yaml. For details about the fields in the secret configuration file, see Table 1 .
apiVersion: v1 kind: Secret metadata: name: backend-demo namespace: huawei-csi type: Opaque stringData: user: "admin" password: "******" authenticationMode: "0"Create a secret.
kubectl apply -f backend-secret.yamlTable 1 Secret field description
Create a ConfigMap resource for the storage backend to store the management configuration of the storage device.
Prepare the ConfigMap configuration file. The following describes how to create an OceanStor SAN storage backend of the iSCSI protocol type. The value of the csi.json key is the storage backend configuration in JSON format. For details about the configuration items, see Configuring the Storage Backend .
apiVersion: v1 kind: ConfigMap metadata: name: backend-demo namespace: huawei-csi data: csi.json: |- { "backends": { "storage": "oceanstor-san", "name": "backend-demo", "namespace": "huawei-csi", "urls": ["https://192.168.129.157:8088"], "pools": ["StoragePool001"], "provisioner": "csi.huawei.com", "parameters": { "protocol": "iscsi", "portals": ["10.10.30.20", "10.10.30.21"] }, "maxClientThreads": "30" } }Create a ConfigMap.
kubectl apply -f backend-configmap.yamlCreate a StorageBackendClaim resource to trigger the CSI controller to access the storage backend. For details about the fields in StorageBackendClaim, see Table 2 .
Prepare the StorageBackendClaim configuration file, for example, backend-claim.yaml.
apiVersion: xuanwu.huawei.io/v1 kind: StorageBackendClaim metadata: name: backend-demo namespace: huawei-csi spec: provider: csi.huawei.com configmapMeta: huawei-csi/backend-demo secretMeta: huawei-csi/backend-demo maxClientThreads: "30"Create a StorageBackendClaim.
kubectl apply -f backend-claim.yamlTable 2 StorageBackendClaim spec field description
Check the storage backend creation result.
kubectl get sbctThe following is an example of the command output. If the online status of StorageBackendContent is true, the creation is successful.
NAME CLAIM SN VENDORNAME PROVIDERVERSION ONLINE AGE content-xxxxxxx huawei-csi/backend-demo xxxxxxxxxxxxxx Huawei 4.12.0 true 53d