1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/monitoring-granting-user-permissions-using-the-cli.adoc

33 lines
1.2 KiB
Plaintext

// Module included in the following assemblies:
//
// * monitoring/enabling-monitoring-for-user-defined-projects.adoc
:_content-type: PROCEDURE
[id="granting-user-permissions-using-the-cli_{context}"]
= Granting user permissions by using the CLI
You can grant users permissions to monitor their own projects, by using the OpenShift CLI (`oc`).
.Prerequisites
* You have access to the cluster as a user with the `cluster-admin` role.
* The user account that you are assigning the role to already exists.
* You have installed the OpenShift CLI (`oc`).
.Procedure
* Assign a monitoring role to a user for a project:
+
[source,terminal]
----
$ oc policy add-role-to-user <role> <user> -n <namespace> <1>
----
<1> Substitute `<role>` with `monitoring-rules-view`, `monitoring-rules-edit`, or `monitoring-edit`.
+
[IMPORTANT]
====
Whichever role you choose, you must bind it against a specific project as a cluster administrator.
====
+
As an example, substitute `<role>` with `monitoring-edit`, `<user>` with `johnsmith`, and `<namespace>` with `ns1`. This assigns the user `johnsmith` permission to set up metrics collection and to create alerting rules in the `ns1` namespace.