IBM Cloud Docs
解决权限和凭证错误

解决权限和凭证错误

当您尝试对群集进行更改(如创建或删除工作节点或其他组件)时,会收到与以下示例类似的错误消息。

The infrastructure authentication credentials are not authorized for the request.
We were unable to connect to your Softlayer account.
Creating a standard cluster requires that you have either a
Pay-As-You-Go account that is linked to an IBM Cloud infrastructure
account term or that you have used the Kubernetes service
CLI to set your Infrastructure API keys.
'Item' must be ordered with permission.
The worker node instance '<ID>' can't be found. Review '<provider>' infrastructure user permissions.
The worker node instance can't be found. Review '<provider>' infrastructure user permissions.
The worker node instance can't be identified. Review '<provider>' infrastructure user permissions.
The IAM token exchange request failed with the message: <message>
IAM token exchange request failed: <message>
The cluster could not be configured with the registry. Make sure that you have the Administrator role for Container Registry.

为区域和资源组设置的基础架构凭证缺少相应的 基础架构权限,或者凭证未被识别。

出现这种情况有多种原因。

  • 您没有所需的基础架构权限。

  • 资源组和区域不匹配。

    • 凭证和 IAM API 密钥被设置为一个区域和一个资源组。 区域在运行 ibmcloud oc credential set 命令时指定。 应用的资源组是运行此命令时的目标资源组。 如果您在运行 ibmcloud oc credential set 命令之前没有使用 ibmcloud target 命令显式地指定一个资源组,那么 API 密钥的资源组有可能不是您预期的资源组,从而导致不匹配的凭据无法识别。
  • 群集中添加或删除了证书。

    • 如果您使用链接的 IBM Cloud 基础架构帐户 创建群集,然后使用 ibmcloud oc credential setibmcloud oc credential unset 添加或删除凭证,则凭证可能与链接帐户的规格不匹配。 这可能导致证书无法识别。

帐户所有者必须正确设置基础架构帐户凭证。 凭证取决于使用的基础架构帐户的类型。

开始之前,"登录您的账户。 如果适用,请将相应的资源组设定为目标。 设置群集的上下文。

  1. 确定用于区域和资源组的基础架构许可权的用户凭证。

    1. 检查集群的区域和资源组的 API 密钥。
      ibmcloud oc api-key info --cluster <cluster_name_or_ID>
      
      示例输出
      Getting information about the API key owner for cluster <cluster_name>...
      OK
      Name                Email
      <user_name>         <name@email.com>
      
    2. 检查区域和资源组的经典基础架构帐户是否手动设置为使用不同的IBM Cloud基础架构帐户。
      ibmcloud oc credential get --region <us-south>
      
      如果证书设置为使用不同的经典账户,则输出示例。 在这种情况下,用户的基础架构凭证将用于目标区域和资源组,即使在上一步中检索到的 API 密钥中存储了其他用户的凭证也是如此。
      OK
      Infrastructure credentials for user name <1234567_name@email.com> set for resource group <resource_group_name>.
      
      如果证书未设置为使用不同的经典账户,则输出示例。 在这种情况下,在上一步中检索到的 API 密钥所有者具有用于区域和资源组的基础架构凭证。
      FAILED
      No credentials set for resource group <resource_group_name>.: The user credentials could not be found. (E0051)
      
  2. 验证用户拥有的基础架构许可权。

    1. 列出区域和资源组的建议和必需的基础架构许可权。

      ibmcloud oc infra-permissions get --region <region>
      

      有关用于分配这些许可权的控制台和 CLI 命令,请参阅经典基础架构角色

    2. 确保 API 密钥的基础架构凭据所有者或手动设置的账户具有正确的权限。 您可以更改 API 密钥手动设置 区域和资源组的基础架构凭据所有者。

  3. 再次尝试执行基础架构操作,如删除群集或工作节点。 如果仍然遇到权限或凭据错误,请查看其他故障排除页面。

    1. 如果没有移除工作节点,请查看 状态状态字段 以及 工作节点的常见问题,以继续调试。
    2. 如果您手动设置了凭据,但仍无法在基础架构账户中看到群集的工作节点,您可以检查 "群集成为孤儿.NET 是否已被删除。
  4. 如果问题仍然存在,请收集以下信息提交给 IBM Cloud 支持。 保存每条命令的输出结果。 确保使用 ibmcloud target -g <resource_group> 命令锁定了正确的资源组。

    1. API 密钥信息。

      ibmcloud ks api-key info --cluster <cluster_name_or_id>
      
    2. 账户详细信息。

      ibmcloud target
      
    3. 预期区域和资源组的证书详细信息。

      ibmcloud oc credential get --region <region>
      
    4. 基础设施权限详情。

      ibmcloud oc infra-permissions get --region <region>
      
  5. [向 IBM Cloud 支持打开一个问题](/docs/openshift?topic=openshift-get-help. 确保包含上一步收集的所有信息和命令输出。

API 密钥无效

经典基础结构

当您尝试完成需要指定 API 密钥的操作时,会出现类似下面的错误。

Error: SoftLayer_Exception_User_Customer_Unauthorized: Invalid API key

此外,运行 ibmcloud ks api-key reset 命令并不能解决问题,而 ibmcloud oc infra-permissions get 命令的输出也没有显示任何权限问题。

出现这种错误有多种原因。

  • 您尝试的操作要求您指定经典基础架构 API 密钥,而不是 Kubernetes API 密钥。 如果为区域设置了经典基础架构 API 密钥,则该密钥优先于所有其他凭证。

  • 您指定的经典基础架构 API 密钥不存在。 它可能已被删除,或者 API 密钥所有者可能已离开组织。

如果您知道经典基础结构 API 密钥,请指定该密钥。 如果不知道基础架构 API 密钥,或认为它可能已被删除,请按照以下步骤操作。

  1. 重置经典基础架构 API 密钥

    ibmcloud oc credential set classic --infrastructure-api-key API_KEY --infrastructure-username USERNAME --region REGION [-q]
    
  2. 运行命令 更新群集上的凭证

    ibmcloud oc api-key reset --region REGION [-q]
    
  3. 再次尝试完成操作。