1.9. 为集群配置添加权限
您可以授予 Argo CD 实例的权限来管理集群配置。创建具有额外权限的集群角色,然后创建新的集群角色绑定以将集群角色与服务帐户关联。
先决条件
-
您可以使用
cluster-admin
权限访问 OpenShift Container Platform 集群,并登录到 web 控制台。 - 在集群中安装了 Red Hat OpenShift GitOps Operator。
流程
在 Web 控制台中,选择 User Management
Roles Create Role。使用以下 ClusterRole
YAML 模板来添加规则来指定额外权限。Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 点 Create 添加集群角色。
-
要创建集群角色绑定,请选择 User Management
Role Bindings Create Binding。 - 从 Project 下拉菜单中选择 All Projects。
- 点 Create binding。
- 将 Binding type 选择为 Cluster-wide role binding(ClusterRoleBinding)。
- 为 RoleBinding 名称 输入一个唯一值。
- 从下拉列表中选择新创建的集群角色或现有集群角色。
选择 Subject 作为 ServiceAccount,并提供 Subject 命名空间和名称。
-
主题命名空间:
openshift-gitops
-
主题名称:
openshift-gitops-argocd-application-controller
-
主题命名空间:
点 Create。
ClusterRoleBinding
对象的 YAML 文件如下:Copy to Clipboard Copied! Toggle word wrap Toggle overflow