IBM Cloud Docs
我需要哪些许可权来管理存储器和创建 PVC?

我需要哪些许可权来管理存储器和创建 PVC?

虚拟私有云 经典基础架构

创建 PVC 时,PVC 保持暂挂状态。 运行 kubectl describe pvc <pvc_name> 时,会看到类似下面的错误信息:

User doesn't have permissions to create or manage Storage

存储在集群的 storage-secret-store Kubernetes 私钥中的 IAM API 密钥或 IBM Cloud 基础架构 API 密钥没有供应持久性存储器所需的所有许可权。

检索存储在集群的 storage-secret-store Kubernetes 私钥中的 IAM 密钥或 IBM Cloud 基础架构 API 密钥,并验证是否使用了正确的 API 密钥。

  1. 运行以下命令获取存储在 storage-secret-store secret 中的 API 密钥。

    示例命令

    kubectl get secret storage-secret-store -n kube-system -o yaml | grep slclient.toml: | awk '{print $2}' | base64 --decode
    

    示例输出

    [Bluemix]
    iam_url = "https://iam.cloud.ibm.com"
    iam_client_id = "bx"
    iam_client_secret = "bx"
    iam_api_key "IAM-API-KEY"
    refresh_token = ""
    pay_tier = "paid"
    containers_api_route = "https://us-south.containers.cloud.ibm.com"
    encryption = true
    containers_api_route_private = "https://private.us-south.containers.cloud.ibm.com"
    
    [Softlayer]
    encryption = true
    softlayer_username = ""
    softlayer_api_key = ""
    softlayer_endpoint_url = "https://api.service.softlayer.com/rest/v3"
    softlayer_iam_endpoint_url = "https://api.service.softlayer.com/mobile/v3"
    softlayer_datacenter = "dal10"
    softlayer_token_exchange_endpoint_url = "https://iam.cloud.ibm.com"
    
    [VPC]
    g2_token_exchange_endpoint_url = "https://iam.bluemix.net"
    g2_riaas_endpoint_url = "https://us-south.iaas.cloud.ibm.com"
    g2_riaas_endpoint_private_url = "https://us-south.private.iaas.cloud.ibm.com"
    g2_resource_group_id = "............"
    g2_api_key = ".............."
    encryption = true
    provider_type = "g2"
    iks_token_exchange_endpoint_private_url = "https://private.us-south.containers.cloud.ibm.com"
    

    IAM API 密钥会列在 CLI 输出的 Bluemix.iam_api_key 部分中。 如果此时 Softlayer.softlayer_api_key 为空,那么会使用 IAM API 密钥来确定您的基础架构许可权。 IAM API 密钥由运行第一个需要资源组和区域中 IAM 管理员平台访问角色的操作的用户自动设置。 如果在 Softlayer.softlayer_api_key 中设置了不同的 API 密钥,那么此密钥优先于 IAM API 密钥。 集群管理员运行 Softlayer.softlayer_api_key 命令时,将设置 ibmcloud ks credentials-set

  2. 如果需要联系支持人员,可以使用以下命令从群集秘密中提取凭证,找到密钥,然后对其进行散列。 此步骤可防止您不小心将 API 密钥粘贴到支持案例中。 运行以下命令,获取群集上存储的当前密钥。

    kubectl  get secret -n kube-system storage-secret-store -o custom-columns=:.data.slclient\\.toml | base64 -d | grep g2_api_key | md5sum
    
  3. 如果要更改凭证,请更新使用的 API 密钥。

    1. 登录您的账户。 如果适用,请将相应的资源组设定为目标。 设置集群的上下文。
    2. 要更新 IAM API 密钥,请使用 ibmcloud ks api-key reset 命令。 要更新 IBM Cloud 基础架构密钥,请使用 ibmcloud ks credential set 命令
    3. 等待 storage-secret-store Kubernetes 私钥更新,此过程大约需要 10 到 15 分钟,然后验证密钥是否已更新。
      kubectl get secret storage-secret-store -n kube-system -o yaml | grep slclient.toml: | awk '{print $2}' | base64 --decode
      
  4. 如果 API 密钥正确,请验证该密钥是否具有供应持久性存储器的正确许可权。

    1. 联系帐户所有者以验证 API 密钥的许可权。
    2. 作为帐户所有者,从 IBM Cloud 控制台的导航中,选择管理 > 访问权 (IAM)
    3. 选择用户,并找到要使用其 API 密钥的用户。
    4. 从“操作”菜单中,选择管理用户详细信息
    5. 转至经典基础架构选项卡。
    6. 展开账户类别,确认已分配添加/升级存储(存储层) 权限。
    7. 展开服务类别,并验证是否已分配存储器管理许可权。
  5. 除去失败的 PVC。

    kubectl delete pvc <pvc_name>
    
  6. 重新创建 PVC。

    kubectl apply -f pvc.yaml