From 479d5f802086bf2d4b061035188c5dc17fc839fb Mon Sep 17 00:00:00 2001 From: Billy Tat Date: Tue, 2 May 2023 10:28:12 -0700 Subject: [PATCH] Apply updates to 2.6 --- .../rbac-for-monitoring.md | 4 +- .../rbac-for-monitoring.md | 62 ++++++++++++++++--- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/docs/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md b/docs/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md index 75c354c0f5d..7993c1040c6 100644 --- a/docs/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md +++ b/docs/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md @@ -99,7 +99,6 @@ The UI won't offer `monitoring-admin`, `monitoring-edit`, and `monitoring-view` 2.4 Click **Create**. - **Result:** The new user should now be able to see the monitoring tools. ### Additional Monitoring ClusterRoles @@ -112,7 +111,6 @@ Monitoring also creates additional `ClusterRoles` that aren't assigned to users ### Assigning Roles and ClusterRoles with kubectl - #### Using `kubectl create` One method is to use either `kubectl create clusterrolebinding` or `kubectl create rolebinding` to assign a `Role` or `ClusterRole`. This is shown in the following examples: @@ -156,7 +154,7 @@ One method is to use either `kubectl create clusterrolebinding` or `kubectl crea Another method is to define bindings in YAML files that you create. You must first configure the `RoleBinding` or `ClusterRoleBinding` with a YAML file. Then, apply the configuration changes by running the `kubectl apply` command. -- **Roles**: Below is an example YAML file to help you configure `RoleBindings` in Kubernetes. You'll need to fill in the name below. +- **Roles**: Below is an example YAML file to help you configure `RoleBindings` in Kubernetes. You'll need to fill in the name below. :::note diff --git a/versioned_docs/version-2.6/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md b/versioned_docs/version-2.6/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md index 505051ccaee..9ef6362e49b 100644 --- a/versioned_docs/version-2.6/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md +++ b/versioned_docs/version-2.6/integrations-in-rancher/monitoring-and-alerting/rbac-for-monitoring.md @@ -72,7 +72,7 @@ Admins may assign custom roles in the Rancher UI for admin, editing, and viewing :::note Important -The UI will not offer `monitoring-admin`, `monitoring-edit`, and `monitoring-view` options when users are being added to a cluster. These monitoring roles can only be assigned by manually creating a custom role that inherits from Project Owner and Project Monitoring View roles. +The UI won't offer `monitoring-admin`, `monitoring-edit`, and `monitoring-view` options when users are being added to a cluster. These monitoring roles can only be assigned by manually creating a custom role that inherits from Project Owner and Project Monitoring View roles. ::: @@ -104,7 +104,7 @@ The UI will not offer `monitoring-admin`, `monitoring-edit`, and `monitoring-vie ### Additional Monitoring ClusterRoles -Monitoring also creates additional `ClusterRoles` that are not assigned to users by default but are created within the cluster. They are not aggregated by default but can be bound to a namespace by deploying a `RoleBinding` or `ClusterRoleBinding` that references it. To define a `RoleBinding` with `kubectl` instead of through Rancher, click [here](#assigning-roles-and-clusterroles-with-kubectl). +Monitoring also creates additional `ClusterRoles` that aren't assigned to users by default but are created within the cluster. They aren't aggregated by default but can be bound to a namespace by deploying a `RoleBinding` or `ClusterRoleBinding` that references it. To define a `RoleBinding` with `kubectl` instead of through Rancher, click [here](#assigning-roles-and-clusterroles-with-kubectl). | Role | Purpose | | ------------------------------| ---------------------------| @@ -112,10 +112,56 @@ Monitoring also creates additional `ClusterRoles` that are not assigned to users ### Assigning Roles and ClusterRoles with kubectl -An alternative method to using Rancher to attach a `Role` or `ClusterRole` to a user or group is by defining bindings in YAML files that you create. You must first configure the `RoleBinding` with the YAML file, then you apply the config changes by running the `kubectl apply` command. +#### Using `kubectl create` +One method is to use either `kubectl create clusterrolebinding` or `kubectl create rolebinding` to assign a `Role` or `ClusterRole`. This is shown in the following examples: -* **Roles**: Below is an example of a YAML file to help you configure `RoleBindings` in Kubernetes. You will need to fill in the name below, and name is case-sensitive. +- Assign to a specific user: + + + + ```plain + kubectl create clusterrolebinding my-binding --clusterrole=monitoring-ui-view --user=u-l4npx + ``` + + + + + ```plain + kubectl create rolebinding my-binding --clusterrole=monitoring-ui-view --user=u-l4npx --namespace=my-namespace + ``` + + + +- Assign to all authenticated users: + + + + ```plain + kubectl create clusterrolebinding my-binding --clusterrole=monitoring-ui-view --group=system:authenticated + ``` + + + + + ```plain + kubectl create rolebinding my-binding --clusterrole=monitoring-ui-view --group=system:authenticated --namespace=my-namespace + ``` + + + + +#### Using YAML Files + +Another method is to define bindings in YAML files that you create. You must first configure the `RoleBinding` or `ClusterRoleBinding` with a YAML file. Then, apply the configuration changes by running the `kubectl apply` command. + +- **Roles**: Below is an example YAML file to help you configure `RoleBindings` in Kubernetes. You'll need to fill in the name below. + +:::note + +Names are case-sensitive. + +::: ```yaml # monitoring-config-view-role-binding.yaml @@ -134,10 +180,10 @@ subjects: apiGroup: rbac.authorization.k8s.io ``` -* **kubectl**: Below is an example of a `kubectl` command used to apply the binding you've created in the YAML file. As noted, you will need to fill in your YAML filename accordingly. - - * **`kubectl apply -f monitoring-config-view-role-binding.yaml` - +- **kubectl**: Below is an example of a `kubectl` command used to apply the binding you've created in the YAML file. Remember to fill in your YAML filename accordingly. + ```plain + kubectl apply -f monitoring-config-view-role-binding.yaml + ``` ## Users with Rancher Based Permissions