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

  1. 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.yaml
    

    Table 1 Secret field description

    Parameter

    Description

    Mandatory

    Default Value

    Remarks

    user

    Username for logging in to the storage.

    Yes

    -

      

    password

    Password for logging in to the storage.

    Yes

    -

      

    authenticationMode

    Authentication mode for logging in to the storage. The value can be:

    • 0: local authentication
    • 1: LDAP authentication

    No

    0

    Only OceanStor Dorado, OceanStor V5, OceanStor V6, OceanStor A600, and OceanStor A800 support LDAP authentication.

    maxClientThreads

    Maximum number of concurrent connections to a storage backend.

    No

    30

    The value ranges from 1 to 30.

  2. 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.yaml
    
  3. Create 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.yaml
    

    Table 2 StorageBackendClaim spec field description

    Parameter

    Description

    Mandatory

    Default Value

    Remarks

    provider

    Provider name, which is used to match the CSI plug-in.

    Yes

    -

    The value is fixed to csi.huawei.com.

    configmapMeta

    Reference to the ConfigMap of the storage configuration information. The format is <namespace>/<name>.

    Yes

    -

    The value must be the same as the name of the ConfigMap created in step 2.

    secretMeta

    Reference to the secret of the storage authentication information. The format is <namespace>/<name>.

    Yes

    -

    The value must be the same as the name of the secret created in step 1.

    maxClientThreads

    Maximum number of concurrent connections to a storage backend.

    No

    30

    The value ranges from 1 to 30.

  4. Check the storage backend creation result.

    kubectl get sbct
    

    The 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