RoleBinding
also: Role Binding, RBAC binding
A Kubernetes object that grants a role (set of permissions) to a user, group, or service account within a namespace or cluster-wide.
A RoleBinding is a Kubernetes resource that links a Role (which defines what actions are allowed) to a subject (a user, group, or service account). It establishes who can perform which operations on which resources.
There are two types: RoleBinding grants permissions within a single namespace, while ClusterRoleBinding grants permissions cluster-wide. For example, a RoleBinding might grant a developer's service account the ability to read and list Pods in the production namespace.
A typical RoleBinding YAML specifies the role to bind, the namespace (for RoleBinding), and the subjects receiving those permissions:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-reader
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-reader-role
subjects:
- kind: ServiceAccount
name: app-sa
namespace: default