liveBook · Manning

RoleBinding

As explained in Kubernetes for Developers

A Kubernetes RoleBinding is a namespace-scoped object that assigns a Role to subjects such as users, groups, or service accounts.

A RoleBinding grants a namespace-scoped Role to subjects such as users, groups, or service accounts. The Role defines permitted API groups, resources, and verbs; the binding connects those permissions to identities. section 12.6

Listing 12.14 Chapter12/12.6_RBAC/rolebinding.yaml
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: developerA
  namespace: team1
roleRef:
  kind: Role
  name: developer-access         #1
  apiGroup: rbac.authorization.k8s.io
subjects:
# Google Cloud user account
- kind: User
  name: example@gmail.com        #2

This manifest binds the developer-access Role in team1 to the user example@gmail.com. section 12.6

Namespace access in practice

A user bound to developer-access can create a Deployment in team1, but the same operation is forbidden in default. The binding does not allow changing the team1 namespace or creating cluster-scoped resources unless separate permissions are granted.

How Kubernetes for Developers covers it

How deep it goes
Defines the binding fields and demonstrates namespace and cluster-scope consequences through kubectl operations.
Examples
Uses a developer binding, team1 namespace, Deployment creation, and denied namespace or cluster-scoped operations.
What it assumes
Requires understanding Roles, subjects, namespaces, API resources, and verbs.
What you can do after
Operate Kubernetes access by binding a named Role to an identity and testing permitted operations.
How it connects
Connects Role, subjects, RBAC, ClusterRole, and ClusterRoleBinding.

Also explained in

Compare how 3 books explain RoleBinding →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.