菜单

这是关于下一个《Grafana》的版本。有关最新的稳定版本,请转到最新版本

使用Grafana提供RBAC

注意:可以在Grafana企业而且Grafana云高级

您可以创建、更改或删除自定义角色创建或删除基本角色分配中添加一个或多个YAML配置文件配置访问控制/目录中。

Grafana在启动期间执行供应。对配置文件进行更改后,可以在运行时重新加载它。您不需要重新启动Grafana服务器以使更改生效。

在开始之前:

  • 确保您可以访问运行Grafana的服务器上的文件。

使用provisioning管理和分配RBAC角色:

  1. 登录到Grafana服务器。

  2. 找到Grafana供应文件夹。

  3. 在以下文件夹中创建一个新的YAML:配置/访问控制.例如,配置/访问控制/ custom-roles.yml

  4. 将RBAC供应细节添加到配置文件中。

    管理RBAC角色而且分配RBAC角色的指令。

    角色配置文件示例获取配置文件的完整示例。

  5. 重新加载供应配置文件。

    有关在运行时重新加载供应配置的详细信息,请参阅重新加载供应配置

使用Grafana配置的角色配置文件示例

下面的例子显示了一个完整的YAML配置文件:

  • 创建自定义角色
  • 删除自定义角色
  • 更新基本角色权限
  • 为团队分配角色
  • 撤销对团队的角色分配

例子

——# config file version apiVersion: 2 # 要插入/更新/删除的角色列表:# 要创建或更新的角色名称。必需的。- name: 'custom:users:writer' # 角色的uid。对所有组织来说都是独一无二的。Uid: customuserswriter1 # 角色描述,仅供参考。description: 'Create, read, write users' # 版本的角色,当角色增加时,Grafana会更新角色。版本号:#  org id。如果未指定,则默认为Grafana的默认值。orgId: 1 # 该角色授予的权限列表。权限:# <字符串,要求>动作允许。 - action: 'users:read' # scope it applies to. scope: 'users:*' - action: 'users:write' scope: 'users:*' - action: 'users:create' - name: 'custom:global:users:reader' #  overwrite org id and creates a global role. global: true #  state of the role. Defaults to 'present'. If 'absent', role will be deleted. state: 'absent' #  force deletion revoking all grants of the role. force: true - uid: 'basic_editor' version: 2 global: true #  list of roles to copy permissions from. from: - uid: 'basic_editor' global: true - name: 'fixed:users:writer' global: true #  list of the permissions to add/remove on top of the copied ones. permissions: - action: 'users:read' scope: 'users:*' - action: 'users:write' scope: 'users:*' #  state of the permission. Defaults to 'present'. If 'absent', the permission will be removed. state: absent #  list role assignments to teams to create or remove. teams: #  name of the team you want to assign roles to. Required. - name: 'Users writers' #  org id. Will default to Grafana's default if not specified. orgId: 1 #  list of roles to assign to the team roles: #  uid of the role you want to assign to the team. - uid: 'customuserswriter1' #  org id. Will default to Grafana's default if not specified. orgId: 1 #  name of the role you want to assign to the team. - name: 'fixed:users:writer' #  overwrite org id to specify the role is global. global: true #  state of the assignment. Defaults to 'present'. If 'absent', the assignment will be revoked. state: absent

使用Terraform提供RBAC设置

Grafana供应