解決權限和憑證錯誤
當您嘗試對叢集進行變更(例如建立或刪除工作執行緒節點或其他元件)時,您會收到類似以下範例之一的錯誤訊息。
在存取您的叢集時,請排除權限與憑證錯誤。
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 target,在執行ibmcloud oc credential set`` 之前,API 金鑰所對應的資源群組可能與您預期不符,導致憑證不匹配而無法被識別。
- 憑證和 IAM API 金鑰設定為區域和資源組。 區域是在執行
-
憑證已新增至叢集或從叢集中刪除。
- 如果您使用連結的 IBM Cloud基礎架構帳戶 建立了集群,然後使用
ibmcloud oc credential set或ibmcloud oc credential unset新增或刪除了憑證,則這些憑證可能與連結帳戶的規格不符。 這可能會導致憑證無法識別。
- 如果您使用連結的 IBM Cloud基礎架構帳戶 建立了集群,然後使用
帳戶擁有者必須適當地設定基礎架構認證帳戶。 認證取決於您所使用的基礎架構帳戶類型。
開始之前,請先登入您的帳戶:。 適用的話,請將適當的資源群組設為目標。 設定集群的上下文。。
-
確定用於地區和資源群組的基礎架構許可權的使用者認證。
- 檢查叢集的地區和資源群組的 API 金鑰。
ibmcloud oc api-key info --cluster <cluster_name_or_ID> ``` 輸出範例 ```sh {: screen} Getting information about the API key owner for cluster <cluster_name>... OK Name Email <user_name> <name@email.com> ``` 2. 請檢查該區域和資源群組的經典基礎架構帳戶是否已手動設定為使用不同的 IBM Cloud 基礎架構帳戶。 ```sh {: pre} ibmcloud oc credential get --region <us-south> ``` **若憑證設定為使用另一個經典帳戶,則輸出範例如下**. 在這種情況下,使用者的基礎架構認證將用於目標地區和資源群組,即使在上一步中擷取到的 API 金鑰中已儲存其他使用者的認證也是如此。 ```sh {: screen} OK Infrastructure credentials for user name <1234567_name@email.com> set for resource group <resource_group_name>. ``` **若未設定使用其他經典帳戶的憑證,則會顯示以下範例輸出**。 在這種情況下,在上一步中擷取到的 API 金鑰擁有者具有用於地區和資源群組的基礎架構認證。 ```sh {: screen} FAILED No credentials set for resource group <resource_group_name>.: The user credentials could not be found. (E0051) ``` -
驗證使用者擁有的基礎架構許可權。
- 列出地區和資源群組的建議和必要的基礎架構許可權。
ibmcloud oc infra-permissions get --region <region> ``` 如需指派這些許可權的主控台和 CLI 指令,請參閱[標準基礎架構角色](/docs/openshift?topic=openshift-iam-platform-access-roles)。 {: tip} 2. 請確保 [API 金鑰或手動設定帳戶的基礎架構憑證擁有者具備正確的權限](/docs/openshift?topic=openshift-iam-platform-access-roles)。 您可以變更 [API 金鑰](/docs/openshift?topic=openshift-kubernetes-service-cli#api-key-reset-cli) 或 [手動設定](/docs/openshift?topic=openshift-kubernetes-service-cli#credential-set-classic-cli) 區域和資源群組的基礎架構憑證擁有者。 {: note} -
再次嘗試執行基礎架構操作,例如刪除叢集或工作節點。 如果您仍然遇到權限或憑證錯誤,請查看這些其他故障排除頁面。
- 若工作節點尚未移除,請檢視 州 以及「狀態」欄位 及 工作節點的常見問題 以繼續進行除錯。
- 如果您已手動設定憑證,但仍無法在您的基礎架構帳戶中看到叢集的工作節點,請檢查 叢集已成為孤兒 是否正常運作。
-
如果問題仍然存在,請收集以下資訊以提交給IBM Cloud支援。 保存每個命令的輸出。 確保
ibmcloud target -g <resource_group>命令的目標資源組正確。- API 金鑰資訊。
ibmcloud ks api-key info --cluster <cluster_name_or_id> ``` 1. 帳戶詳細資料。 ```sh {: pre} ibmcloud target ``` 1. 預期區域和資源組的憑證詳細資訊。 ```sh {: pre} ibmcloud oc credential get --region <region> ``` 1. 基礎設施權限詳細資料。 ```sh {: pre} ibmcloud oc infra-permissions get --region <region> ``` -
[向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 金鑰或您認為它可能已被刪除,請按照下列步驟操作。
-
ibmcloud oc credential set classic --infrastructure-api-key API_KEY --infrastructure-username USERNAME --region REGION [-q] -
運行命令以 更新叢集上的憑證。
ibmcloud oc api-key reset --region REGION [-q] -
再次嘗試完成該操作。