1.6. About Lightspeed and Role Based Access Control (RBAC)
Role-Based Access Control (RBAC) is a system security approach to restricting system access to authorized users who have defined roles and permissions.
OpenShift Lightspeed RBAC is binary. By default, not all cluster users have access to the OpenShift Lightspeed interface. Access must be granted by a user who can grant permissions. All users of an OpenShift cluster with OpenShift Lightspeed installed can see the OpenShift Lightspeed button; however, only users with permissions can submit questions to OpenShift Lightspeed.
If you want to evaluate the RBAC features of OpenShift Lightspeed, your cluster will need users other than the kubeadmin account. The kubeadmin account always has access to OpenShift Lightspeed.
1.6.1. Granting access to an individual user 复制链接链接已复制到粘贴板!
This procedure explains how to grant access to an individual user.
Prerequisites
-
You are logged in to the OpenShift Container Platform web console as a user with the
cluster-adminrole. Alternatively, you are logged in as a user with the ability to grant permissions. - You have deployed the OpenShift Lightspeed service.
-
You have access to the OpenShift CLI (
oc).
Procedure
Run the following command at the command line:
$ oc adm policy add-cluster-role-to-user \ lightspeed-operator-query-access <user_name>Alternatively, you can use a YAML file when granting access to an individual user by using the following command:
$ oc adm policy add-cluster-role-to-user lightspeed-operator-query-access <user_name> -o yaml --dry-runThe terminal returns the following output:
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: creationTimestamp: null name: lightspeed-operator-query-access roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: lightspeed-operator-query-access subjects: - apiGroup: rbac.authorization.k8s.io kind: User name: <user_name>1 - 1
- Enter the actual user name in place of
<user_name>before creating the object.
Save the output as a YAML file, and run the following command to grant user access:
$ oc create -f <filename>
1.6.2. Granting access to a user group 复制链接链接已复制到粘贴板!
This procedure explains how to grant access to a user group. If your cluster has more advanced identity management configured, including user groups, you can grant all users of a specific group access to the OpenShift Lightspeed service.
Prerequisites
-
You are logged in to the OpenShift Container Platform web console as a user with the
cluster-adminrole. Alternatively, you are logged in as a user with the ability to grant permissions. - You have deployed the OpenShift Lightspeed service.
- You have access to the OpenShift CLI (oc).
Procedure
Run the following command at the command line:
$ oc adm policy add-cluster-role-to-group \ lightspeed-operator-query-access <group_name>Alternatively, you can use a YAML file when granting access to a user group by using the following command:
$ oc adm policy add-cluster-role-to-group lightspeed-operator-query-access <group_name> -o yaml --dry-runThe terminal returns the following output:
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: creationTimestamp: null name: lightspeed-operator-query-access roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: lightspeed-operator-query-access subjects: - apiGroup: rbac.authorization.k8s.io kind: Group name: <user_group>1 - 1
- Enter the actual user group in place of
<user_group>before creating the object.
Save the output as a YAML file, and run the following command to grant access to the user group:
$ oc create -f <filename>