azure - CI/CD 尝试从 Jenkins 部署到 AKS 失败
问题描述
我使用以下工具获得了用于 CI/CD 的 Microsoft 模板之一:Jenkins、Docker (ACS)、Kubernetes (AKS)。此模板附带一个管道示例,但在尝试启动它时,尝试与 Azure Kubernetes (AKS) 集成时出现以下错误:
Starting Azure Container Service / Kubernetes Service Deployment
Delete Kubernetes management config file
/var/lib/jenkins/workspace/hello-world/kubeconfig-7112538207763465492
ERROR: ERROR: Status code 403, {"error":
{"code":"AuthorizationFailed","message":"The client '7912b768-a178-4996-
b6e6-38912a9b90da' with object id '7912b768-a178-4996-b6e6-38912a9b90da'
does not have authorization to perform action
'Microsoft.ContainerService/managedClusters/accessProfiles
/listCredential/action' over scope '/subscriptions/4e601d44-4d18-4e49-
95001793e668f9e0/resourcegroups/SystemBackend_Resource/
providers/Microsoft.ContainerService/managedClusters/aksa5ru5sgbdaum2/
accessProfiles/clusterAdmin'."}}
任何想法?
解决方案
该错误说明了一切,您用于访问 AKS 群集的客户端(凭据)无权在该群集上使用 listCredentials 操作。您需要授予该客户端这些权限。7912b768-a178-4996-b6e6-38912a9b90da
向SystemBackend_Resource
资源组授予贡献者权限的最简单方法。
New-AzureRmRoleAssignment -ObjectId 7912b768-a178-4996-b6e6-38912a9b90da `
-RoleDefinitionName "Contributor" `
-Scope '/subscriptions/4e601d44-4d18-4e49-95001793e668f9e0/resourcegroups/SystemBackend_Resource/'
您显然可以使用自定义角色仅向该实体授予该权限,但这只是一个示例
推荐阅读
- javascript - 选择所有复选框不调用每个复选框的 JS 函数
- symfony - 无休止的页面加载从 symfony 中的存储库(学说)获取数据
- python - 编写 BIG pandas DataFrame 的最快方法
- python - 我正在寻找如何在 Python 中重新创建类似的图表
- javascript - 在 JavaScript 中将美元转换为美分
- python - 在 Python 中,有效过滤可能组合的子序列
- cuda - 在抛出 'thrust::system::system_error' 的实例后调用终止 what(): parallel_for failed: cudaErrorInvalidValue: invalid argument
- typo3 - TYPO3 routeEnhancers 用于新闻存档(DateMenu)和分页
- sql - 从 ROW_Number 中选择连续行
- google-cloud-platform - 将数据从 API 上传到 GCP 数据准备