liveBook · Manning

Role

As explained in Google Anthos in Action

A Kubernetes Role is a namespace-scoped RBAC resource that defines permissions on resources.

A Kubernetes Role defines permissions on one or more resources within a namespace. It must be created in a namespace, and its permissions can be assigned only there. Use a Role when access should not extend to other namespaces in a shared cluster. section 3.2.6

A Role defines the permission set; a binding assigns permissions to a user or service. A RoleBinding is namespace-scoped. By contrast, a ClusterRole can be used cluster-wide or assigned within a namespace, while a ClusterRoleBinding assigns permissions cluster-wide. Check both the permission resource and the binding before granting access. section 3.2.6

Console access to an attached cluster

Token login to an attached cluster requires a Kubernetes Service Account with suitable RBAC permissions. The example binds the account to `view` and `cloud-console-reader` using ClusterRoleBindings—not to a namespace-scoped Role. The former provides read-only access to most objects in a namespace but excludes roles and role bindings; the latter permits viewing nodes, persistent volumes, and storage classes in the console. section 2.7

Table 3.6 Roles used in Kubernetes (view table figure)

Role type

Scope

Description

Role

Namespace

Permissions in a Role can be used only in the namespace in which it was created.

ClusterRole

Cluster

Permissions in a ClusterRole can be used cluster wide.

Compare where Role and ClusterRole permissions can be used. section 3.2.6

How Google Anthos in Action covers it

How deep it goes
Defines Role scope and distinguishes permission sets from bindings, without providing a Role manifest or creation command.
Examples
Contrasts Role scope with ClusterRole and binding tables, then shows service-account access through ClusterRoleBindings for console login.
What it assumes
Assumes familiarity with Kubernetes namespaces; introduces the RBAC distinction between permissions and their assignment.
What you can do after
Evaluate/understand whether permissions should remain namespace-scoped or use cluster-level RBAC resources.
How it connects
Connects Roles to namespaces, RBAC, RoleBindings, ClusterRoles, and ClusterRoleBindings.

Also explained in

Compare how 2 books explain role →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Google Anthos in Action. The section links point to the parts of the book it draws on.