This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.第8章 ロールベースアクセス制御 (RBAC) の管理
8.1. 概要 リンクのコピーリンクがクリップボードにコピーされました!
You can use the CLI to view RBAC resources and the administrator CLI to manage the roles and bindings.
8.2. Viewing Roles and Bindings リンクのコピーリンクがクリップボードにコピーされました!
Roles can be used to grant various levels of access both cluster-wide as well as at the project-scope. Users and groups can be associated with, or bound to, multiple roles at the same time. You can view details about the roles and their bindings using the oc describe
command.
Users with the cluster-admindefault cluster role bound cluster-wide can perform any action on any resource. Users with the admin default cluster role bound locally can manage roles and bindings in that project.
Review a full list of verbs in the Evaluating Authorization section.
8.2.1. Viewing Cluster Roles リンクのコピーリンクがクリップボードにコピーされました!
クラスターロールおよびそれらの関連付けられたルールセットを表示するには、以下を実行します。
oc describe clusterrole.rbac
$ oc describe clusterrole.rbac
Viewing Cluster Roles
各種のロールにバインドされたユーザーおよびグループを示す、クラスターのロールバインディングの現在のセットを表示するには、以下を実行します。
oc describe clusterrolebinding.rbac
$ oc describe clusterrolebinding.rbac
Viewing Cluster Role Bindings
8.2.2. Viewing Local Roles and Bindings リンクのコピーリンクがクリップボードにコピーされました!
All of the default cluster roles can be bound locally to users or groups.
カスタムローカルロールを作成できます。
ローカルのロールバインディングも表示することができます。
各種のロールにバインドされたユーザーおよびグループを示す、ローカルのロールバインディングの現在のセットを表示するには、以下を実行します。
oc describe rolebinding.rbac
$ oc describe rolebinding.rbac
By default, the current project is used when viewing local role bindings. Alternatively, a project can be specified with the -n
flag. This is useful for viewing the local role bindings of another project, if the user already has the admindefault cluster role in it.
Viewing Local Role Bindings
8.3. Managing Role Bindings リンクのコピーリンクがクリップボードにコピーされました!
Adding, or binding, a role to users or groups gives the user or group the relevant access granted by the role. You can add and remove roles to and from users and groups using oc adm policy
commands.
以下の操作を使用し、ローカルのロールバインディングでのユーザーまたはグループの関連付けられたロールを管理する際に、プロジェクトは -n
フラグで指定できます。これが指定されていない場合には、現在のプロジェクトが使用されます。
コマンド | 説明 |
---|---|
|
リソースに対してアクションを実行できるユーザーを示します。 |
|
指定されたロールを現在のプロジェクトの指定ユーザーにバインドします。 |
|
現在のプロジェクトの指定ユーザーから指定されたロールを削除します。 |
|
現在のプロジェクトの指定ユーザーとそれらのロールのすべてを削除します。 |
|
指定されたロールを現在のプロジェクトの指定グループにバインドします。 |
|
現在のプロジェクトの指定グループから指定されたロールを削除します。 |
|
現在のプロジェクトの指定グループとそれらのロールのすべてを削除します。 |
You can also manage cluster role bindings using the following operations. The -n
flag is not used for these operations because cluster role bindings uses non-namespaced resources.
コマンド | 説明 |
---|---|
|
指定されたロールをクラスターのすべてのプロジェクトの指定ユーザーにバインドします。 |
|
指定されたロールをクラスターのすべてのプロジェクトの指定ユーザーから削除します。 |
|
指定されたロールをクラスターのすべてのプロジェクトの指定グループにバインドします。 |
|
指定されたロールをクラスターのすべてのプロジェクトの指定グループから削除します。 |
たとえば、以下を実行して admin ロールを joe-project の alice ユーザーに追加できます。
oc adm policy add-role-to-user admin alice -n joe-project
$ oc adm policy add-role-to-user admin alice -n joe-project
次に、ローカルのロールバインディングを表示し、出力に追加されていることを確認します。
- 1
- The alice user has been added to the admins
RoleBinding
.
8.4. Creating a Local Role リンクのコピーリンクがクリップボードにコピーされました!
プロジェクトのローカルロールを作成するには、以下のコマンドを実行します。
oc create role ...
$ oc create role ...
The following excerpt from the help of this command describes its usage:
For example, to create a role that allows a user to view pods, run:
oc create role podview --verb=get --resource=pod -n bob-project
$ oc create role podview --verb=get --resource=pod -n bob-project
Optionally, annotate it with a description.
To bind the new role to a user, run:
oc adm policy add-role-to-user podview user2 --role-namespace=bob-project -n bob-project
$ oc adm policy add-role-to-user podview user2 --role-namespace=bob-project -n bob-project
8.5. Cluster and Local Role Bindings リンクのコピーリンクがクリップボードにコピーされました!
A cluster role binding is a binding that exists at the cluster level. A role binding exists at the project level. The cluster role view must be bound to a user using a local role binding for that user to view the project. Local roles should only created if a cluster role does not provide the set of permissions needed for a particular situation.
Some cluster role names are initially confusing. The cluster role clusteradmin
can be bound to a user using a local role binding, making it appear that this user has the privileges of a cluster administrator. This is not the case. The clusteradmin
cluster role bound to a certain project is more like a super administrator for that project, granting the permissions of the cluster role admin
, plus a few additional permissions like the ability to edit rate limits. This can appear especially confusing via the web console UI, which does not list cluster role bindings (which are bound to true cluster administrators). However, it does list local role bindings (which could be used to locally bind clusteradmin
).