$ oc create clusterrolebinding <any_valid_name> --clusterrole=sudoer --user=<username>
您可以将请求配置为 OpenShift Container Platform API,使其行为如同来自另一个用户。更多信息,请参见 Kubernetes 文档中的用户模拟。
您可以授予用户模拟system:admin
的权限,这将赋予他们集群管理员权限。
要授予用户模拟system:admin
的权限,请运行以下命令:
$ oc create clusterrolebinding <any_valid_name> --clusterrole=sudoer --user=<username>
或者,您可以应用以下 YAML 来授予模拟
|
当system:admin
用户通过组被授予集群管理员权限时,您必须在命令中包含--as=<user> --as-group=<group1> --as-group=<group2>
参数来模拟关联的组。
要授予用户通过模拟关联的集群管理组来模拟system:admin
的权限,请运行以下命令:
$ oc create clusterrolebinding <any_valid_name> --clusterrole=sudoer --as=<user> \
--as-group=<group1> --as-group=<group2>
作为集群管理员,您可以通过创建集群角色绑定,将未经身份验证的用户添加到 OpenShift Container Platform 中的以下集群角色。未经身份验证的用户无权访问非公共集群角色。这应仅在必要时且在特定用例中执行。
您可以将未经身份验证的用户添加到以下集群角色:
system:scope-impersonation
system:webhook
system:oauth-token-deleter
self-access-reviewer
修改未经身份验证的访问权限时,请务必验证是否符合您组织的安全标准。 |
您可以作为具有cluster-admin
角色的用户访问集群。
您已安装 OpenShift CLI (oc
)。
创建一个名为add-<cluster_role>-unauth.yaml
的 YAML 文件,并添加以下内容:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
name: <cluster_role>access-unauthenticated
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: <cluster_role>
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: system:unauthenticated
运行以下命令来应用配置:
$ oc apply -f add-<cluster_role>.yaml