我需要哪些許可權來管理儲存體及建立 PVC?
排除持久性卷標聲明中的權限錯誤。
虛擬私有雲 傳統基礎設施
建立 PVC 時,PVC 保持擱置狀態。 當您執行 oc 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 金鑰。
-
執行下列指令以取得儲存在
storage-secret-storesecret 中的 API 金鑰。指令範例
oc 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 oc credentials-set。 -
如果您需要聯絡支援,可以使用下列指令從叢集秘密中提取憑證,找出金鑰,然後將其雜湊。 此步驟可避免您不小心將 API 金鑰貼到支援個案中。 執行下列指令以擷取儲存在群集中的目前金鑰。
oc get secret -n kube-system storage-secret-store -o custom-columns=:.data.slclient\\.toml | base64 -d | grep g2_api_key | md5sum -
如果要變更認證,請更新使用的 API 金鑰。
- 請登入您的帳戶。 適用的話,請將適當的資源群組設為目標。 設定叢集的環境定義。
- 若要更新 IAM API 金鑰,請使用
ibmcloud oc api-key reset指令。 若要更新 IBM Cloud 基礎架構金鑰,請使用ibmcloud oc credential set指令。 - 等待
storage-secret-storeKubernetes 密碼更新,此過程大約需要 10 到 15 分鐘,然後驗證金鑰是否已更新。
oc get secret storage-secret-store -n kube-system -o yaml | grep slclient.toml: | awk '{print $2}' | base64 --decode ``` -
如果 API 金鑰正確,請驗證該金鑰是否具有佈建持續性儲存空間的正確許可權。
- 聯絡帳戶擁有者以驗證 API 金鑰的許可權。
- 身為帳戶擁有者,請在 IBM Cloud 控制台的導覽列中,選擇「管理」>「存取權限 (IAM)」。
- 選取使用者,並尋找要使用其 API 金鑰的使用者。
- 從「動作」功能表中,選取管理使用者詳細資料。
- 移至標準基礎架構標籤。
- 展開「帳戶」類別,並確認已指派「新增/升級儲存空間(儲存層)」權限。
- 展開服務種類,並驗證是否已指派儲存空間管理許可權。
-
移除失敗的 PVC。
oc delete pvc <pvc_name> -
重新建立 PVC。
oc apply -f pvc.yaml