Role-based access control (RBAC) is an access control model in which permissions are bundled into roles that reflect job functions, and users or service accounts are assigned to those roles instead of receiving permissions directly. A user can do exactly what the roles assigned to them allow. RBAC makes access easier to grant, review and revoke, and it is a common way to implement least privilege in applications, cloud platforms and Kubernetes.
What is RBAC?
Role-based access control answers the question "who may do what" with an intermediate layer: the role. Instead of giving Alice read access to ten dashboards and edit access to three alert rules, you define a role such as on-call engineer, attach the permissions to the role and assign Alice to it. When Alice changes teams, you change one assignment, not dozens of individual rights.
The model was formalised by David Ferraiolo and Richard Kuhn at NIST in the early 1990s and later standardised as ANSI/INCITS 359. Today it is the default model in most business software, in cloud IAM systems and in Kubernetes.
Core concepts
- Users and subjects: people, but also service accounts, API keys and workloads.
- Permissions: an allowed operation on a resource, for example
readon dashboards ordeleteon pods in a namespace. - Roles: named sets of permissions that match a job function, such as viewer, editor, admin or billing manager.
- Assignments: the link between a subject and a role, often scoped to a project, team or namespace.
- Role hierarchies: a senior role can inherit the permissions of a junior role, for example admin includes editor.
- Separation of duties: constraints that prevent one person from holding conflicting roles, such as creating and approving a payment.
The important property is that permissions are never granted to users directly. Every right can be explained by a role, which makes reviews and audits far simpler.
RBAC compared with other models
| Model | Access decided by | Strengths | Weaknesses |
|---|---|---|---|
| Access control lists (ACL) | A list of subjects per resource | Simple, precise for single objects | Hard to review across many resources |
| RBAC | Roles assigned to subjects | Easy to understand, review and audit | Roles multiply when every exception becomes a role |
| Attribute-based (ABAC) | Attributes of user, resource and context | Fine-grained, context aware | Policies are harder to read and test |
| Relationship-based (ReBAC) | Relationships such as owner or member of | Fits sharing and collaboration features | Needs a dedicated authorization service |
In practice these models are combined. A cloud platform may use roles as the base and add conditions, such as region or resource tags, on top.
RBAC in Kubernetes
Kubernetes has RBAC built in through the rbac.authorization.k8s.io API. A Role defines permissions in one namespace, a ClusterRole applies cluster-wide or can be reused in many namespaces, and a RoleBinding or ClusterRoleBinding assigns them to users, groups or service accounts. Permissions are purely additive: there are no deny rules. The following binding gives a CI service account the built-in edit ClusterRole, but only in the checkout namespace:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ci-deployer
namespace: checkout
subjects:
- kind: ServiceAccount
name: ci-deployer
namespace: ci
roleRef:
kind: ClusterRole
name: edit
apiGroup: rbac.authorization.k8s.io
To check what a subject may do, ask the API server directly:
kubectl auth can-i delete pods -n checkout \
--as=system:serviceaccount:ci:ci-deployer
kubectl auth can-i --list -n checkout \
--as=system:serviceaccount:ci:ci-deployer
Every pod runs under a service account, so RBAC also decides what a compromised container could do with the Kubernetes API.
RBAC in your own applications
Inside an application, RBAC usually starts as a mapping from roles to permissions. The important design choice is to check permissions in code, not role names. Code that asks "is this user an admin?" has to change every time the role model changes; code that asks "may this user edit alert rules?" does not.
ROLE_PERMISSIONS = {
"viewer": {"dashboard:read", "alert:read"},
"editor": {"dashboard:read", "dashboard:write", "alert:read", "alert:write"},
"admin": {"dashboard:read", "dashboard:write", "alert:read", "alert:write",
"user:manage", "apikey:manage"},
}
def can(user, permission):
return any(permission in ROLE_PERMISSIONS[r] for r in user.roles)
if not can(current_user, "alert:write"):
audit_log("denied", current_user.id, "alert:write")
raise Forbidden()
A few rules keep such a model safe. Deny by default, so a missing entry never grants access. Enforce every check on the server, never only by hiding buttons in the interface. Scope assignments, for example to a team or project, so that an editor in one team is not automatically an editor everywhere. And log denied requests, because they show both misconfigured roles and attempts to reach data that a user should not see.
Common mistakes
- Role explosion: a new role for every exception until nobody understands the set. Prefer a small number of roles plus scoping by team or project.
- Admin by default: giving new users or service accounts the most powerful role to avoid support requests. In Kubernetes, bindings to
cluster-adminare the classic case. - Wildcards: rules with
verbs: ["*"]orresources: ["*"]that silently include future resources. - Dangerous permissions hidden in harmless roles: in Kubernetes, rights such as creating pods, reading secrets or the
escalate,bindandimpersonateverbs can enable privilege escalation. - Roles for individuals: a role named after a person is a direct permission in disguise.
- No reviews: assignments accumulate as people change jobs, a pattern known as privilege creep.
Best practices
- Start from job functions and tasks, not from the org chart, and keep the number of roles small.
- Apply least privilege: the default role should be read-only, with write and admin rights granted deliberately.
- Use groups from your identity provider for assignments, so leaving the company or a team removes access automatically.
- Give every application and script its own service account or API key, with its own narrow role.
- Manage roles and bindings as code with infrastructure as code, so changes go through review.
- Review assignments regularly and remove roles that have not been used.
- Log every role assignment, every permission change and every denied request.
The observability perspective
RBAC is only as good as the evidence that it works. Audit logs show which roles were assigned and changed, and access logs show which permissions are actually used. Denied requests are particularly useful: a sudden spike of 403 responses after a deployment usually means a missing permission, while repeated denials for one identity across many resources can point to probing with stolen credentials. Feeding these events into a SIEM lets teams correlate them with other signals and with the ideas of zero trust, where every request is checked.
How Obseria helps
Obseria does not manage permissions in your own systems, but it helps you check them and applies RBAC to itself. Cloud security posture management checks AWS, Azure and Google Cloud accounts for misconfigurations such as overly broad access rights, and IaC security reviews Terraform and Kubernetes manifests for insecure configuration before deployment. For access to Obseria, access control and SSO provides roles, permissions, teams and sign-in with your company login, plus API keys for scripts and integrations. The audit trail records who changed what and when.