HBlock CSI插件调用HBlock HTTP RESTful API时,需要提供用户名和密码以进行签名认证,用户名为HBlock用户名,密码为HBlock的密码。
可以按照下列步骤配置HBlock访问用户名和密码。
-
修改配置文件。
修改deploy/csi-plugin-conf/csi-secret.yaml配置文件中的参数。apiVersion: v1 kind: Secret metadata: name: csi-plugin-stor-secret type: Opaque data: userKey: userkey //对接HBlock的标识、用户名及密码的字符串的base64编码
userKey 源码
[ { "clusterID": "cluster1", "username": "storuser", "password": "YOUR_PASSWORD1" }, { "clusterID": "cluster2", "username": "storuser", "password": "YOUR_PASSWORD2" } ]
参数
参数 描述 是否必填 userKey 对接HBlock的标识、用户名及密码的字符串的base64编码。 是 clusterID csi-configMap.yaml中配置的HBlock的标识。 是 username HBlock的管理员用户名。 是 password HBlock的管理员密码。 是 示例:
-
userKey的源码如下:
[ { "clusterID": "stor1", "username": "storuser", "password": "hblock12@" }, { "clusterID": "stor2", "username": "storuser", "password": "hblock12@" } ]
-
使用Base64工具对userKey源码进行编码。编码后的userKey如下:
WwogICAgICB7CiAgICAgICAgImNsdXN0ZXJJRCI6ICJzdG9yMSIsICAKICAgICAgICAidXNlcm5hbWUiOiAic3RvcnVzZXIiLAogICAgICAgICJwYXNzd29yZCI6ICJoYmxvY2sxMkAiCiAgICAgIH0sCiAgICAgIHsKICAgICAgICAiY2x1c3RlcklEIjogInN0b3IyIiwgIAogICAgICAgICJ1c2VybmFtZSI6ICJzdG9ydXNlciIsCiAgICAgICAgInBhc3N3b3JkIjogImhibG9jazEyQCIKICAgICAgfQogICAgXQo=
-
修改配置文件deploy/csi-plugin-conf/csi-secret.yaml配置文件中的参数。
apiVersion: v1 kind: Secret metadata: name: csi-plugin-stor-secret type: Opaque data: userKey: WwogICAgICB7CiAgICAgICAgImNsdXN0ZXJJRCI6ICJzdG9yMSIsICAKICAgICAgICAidXNlcm5hbWUiOiAic3RvcnVzZXIiLAogICAgICAgICJwYXNzd29yZCI6ICJoYmxvY2sxMkAiCiAgICAgIH0sCiAgICAgIHsKICAgICAgICAiY2x1c3RlcklEIjogInN0b3IyIiwgIAogICAgICAgICJ1c2VybmFtZSI6ICJzdG9ydXNlciIsCiAgICAgICAgInBhc3N3b3JkIjogImhibG9jazEyQCIKICAgICAgfQogICAgXQo=
-
-
应用配置文件。
[root@server csi-plugin-conf]# kubectl apply -f csi-secret.yaml secret/csi-plugin-stor-secret configured