Sud*_*hoe 5 azure azure-active-directory azure-aks
目前,我正在尝试在 Azure 上的 AKS kubernetes 集群内部署应用程序。
对于部署管道,我想使用通过天蓝色活动目录(例如服务主体)管理的服务帐户。
我已经通过 Azure CLI 创建了一个服务主体。
使此服务主体在 AKS 群集内称为服务帐户的正确方法是什么?
我需要服务帐户而不是用户帐户的原因是因为我想从我的 DevOps 管道中使用它而不需要登录,但仍然能够通过 Active Directory 管理它。
目前,我正在使用默认服务帐户在命名空间内部署容器,这是可行的,但该帐户仅在命名空间内已知,而不是集中管理。
# This binding enables a cluster account to deploy on kubernetes
# You can confirm this with
# kubectl --as="${USER}" auth can-i create deployments
# See also: https://github.com/honestbee/drone-kubernetes/issues/8
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: default
name: default-deploy
rules:
- apiGroups: ["extensions"]
resources: ["deployments"]
verbs: ["get","list","patch","update", "create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: role-default-deploy
namespace: default
roleRef:
kind: Role
name: default-deploy
apiGroup: rbac.authorization.k8s.io
subjects:
# working, the default account configured with deploy permissions
- name: default
kind: ServiceAccount
namespace: default
# works, if the service principal is configured as a User
- name: "111111-0000-1111-0000-********"
apiGroup: rbac.authorization.k8s.io
kind: User
# this does not work, the service principal is configured as a Service Account
- name: "111111-0000-1111-0000-********"
apiGroup: rbac.authorization.k8s.io
kind: ServiceAccount
Run Code Online (Sandbox Code Playgroud)
我希望也能够通过 RBAC 配置服务帐户,但是我收到以下错误:
The RoleBinding "role-default-deploy" is invalid:
subjects[1].apiGroup: Unsupported value:
"rbac.authorization.k8s.io": supported values: ""
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1026 次 |
| 最近记录: |