Skip to content

All posts

Kubernetes

How to show Kubernetes RBAC access to auditors: roles, bindings and access reviews

Ritesh Patel

Kubernetes: How to show Kubernetes RBAC access to auditors: roles, bindings and access reviews

To show an auditor who can reach Kubernetes Secrets, export every Role, ClusterRole and binding that grants access, read each binding’s subjects and roleRef, then add the kube-apiserver audit log entries that show what those identities did. RBAC permissions are additive, so the answer must cover every binding in the cluster, including the ones nobody remembers creating.

Checked against the Kubernetes RBAC and auditing documentation as fetched on 2026-11-29. Those pages don’t tie the objects or flags in this post to a Kubernetes release, so confirm the behaviour against the version your cluster runs.

Start with the objects that grant access

A Role grants permissions inside one namespace. A ClusterRole is not namespaced, so it can grant access across the whole cluster. The RBAC page shows a Role named pod-reader in the default namespace that allows get, watch and list on pods. It also shows a ClusterRole named secret-reader with the same verbs on secrets.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  namespace: default
  name: pod-reader
rules:
- apiGroups: [""] # "" indicates the core API group
  resources: ["pods"]
  verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  # "namespace" omitted since ClusterRoles are not namespaced
  name: secret-reader
rules:
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["get", "watch", "list"]

Export both kinds of object, including the ones your team never names in tickets. The scope of a ClusterRole depends on its binding: a RoleBinding that references it reaches only that binding’s namespace, while a ClusterRoleBinding reaches every namespace.

Bindings connect subjects to roles

A binding is what attaches a subject to a role. A RoleBinding can reference a Role in its own namespace, or it can reference a ClusterRole and bind that ClusterRole only to the RoleBinding’s namespace. The page says a ClusterRoleBinding is the way to bind a ClusterRole to all namespaces in the cluster.

apiVersion: rbac.authorization.k8s.io/v1
# This role binding allows "jane" to read pods in the "default" namespace.
# You need to already have a Role named "pod-reader" in that namespace.
kind: RoleBinding
metadata:
  name: read-pods
  namespace: default
subjects:
# You can specify more than one "subject"
- kind: User
  name: jane # "name" is case sensitive
roleRef:
  # "roleRef" specifies the binding to a Role / ClusterRole
  kind: Role # this must be Role or ClusterRole
  name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to
  apiGroup: rbac.authorization.k8s.io

The roleRef is fixed once the binding exists. The page says that changing it returns a validation error, and that you must delete the binding and create a replacement. Record both steps in your change evidence, because the replacement is a new object with its own history.

apiVersion: rbac.authorization.k8s.io/v1
# This cluster role binding allows anyone in the "manager" group to read secrets in any namespace.
kind: ClusterRoleBinding
metadata:
  name: read-secrets-global
subjects:
- kind: Group
  name: manager # Name is case sensitive
  apiGroup: rbac.authorization.k8s.io
roleRef:
  kind: ClusterRole
  name: secret-reader
  apiGroup: rbac.authorization.k8s.io

A subject can be a user, a group or a service account. An auditor who reads only user names will miss the group binding above, because every member of the manager group gets secret read access in every namespace.

Aggregated ClusterRoles change the rules you read

A ClusterRole can carry an aggregationRule instead of rules of its own. A control plane controller combines the rules of other ClusterRoles that match the label selector into its rules field. The page warns that the control plane overwrites any rules you set by hand in an aggregate ClusterRole.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: monitoring
aggregationRule:
  clusterRoleSelectors:
  - matchLabels:
      rbac.example.com/aggregate-to-monitoring: "true"
# The control plane automatically fills in the rules

Export the rules field after aggregation, not the YAML you committed. Evidence built from the source file can show less access than the cluster grants.

Show who can read secrets

Secret access is the question auditors ask most often. Work through the bindings in both scopes, then write the answer as a list that names each subject, its binding and the role behind it.

  1. List every Role and ClusterRole whose rules include secrets with get, list or watch.
  2. For each of those roles, find every RoleBinding in each namespace that references it through roleRef.
  3. Find every ClusterRoleBinding that references the same role, and note the namespaces each one reaches.
  4. Expand each subjects entry. A group, a service account or a user can each hold the access, so record all three kinds.
  5. Keep the result with its export date. Access changes, so a list from last quarter answers a different question.

Log who did what with the audit policy

Access rules show what could happen. The audit log shows what did. The auditing page describes audit events as records of requests to the kube-apiserver, pre-processed by an audit policy before they are written to a backend. The policy file is passed to kube-apiserver with --audit-policy-file. The page says that if the flag is omitted, no events are logged. Set the log backend with --audit-log-path, and control retention with --audit-log-maxage, --audit-log-maxbackup and --audit-log-maxsize. Use - for --audit-log-path to write to standard out.

apiVersion: audit.k8s.io/v1 # This is required.
kind: Policy
# Don't generate audit events for all requests in RequestReceived stage.
omitStages:
  - "RequestReceived"
rules:
  # Log pod requests (all verbs, all namespaces) at RequestResponse level
  - level: RequestResponse
    resources:
    - group: ""
      resources: ["pods"]
  # Log secret and configmap requests (all verbs, all namespaces) at the Metadata level. This rule has no namespace filter.
  - level: Metadata
    resources:
    - group: "" # core API group
      resources: ["secrets", "configmaps"]

The rules above combine two examples from the auditing page into one policy, so check the assembled file with your cluster’s API server before you rely on it. The page says the first matching rule sets the audit level for an event, and that a policy with no rules is illegal.

Audit levels and what each one keeps

The auditing page defines four levels. Pick the lowest level that still answers the auditor’s question, because higher levels store more of each request.

Level What the event records Use it for
None Nothing for matching requests Noisy, low-value traffic you have decided to skip
Metadata Requesting user, timestamp, resource, verb and similar fields, without request or response bodies Who read or changed Secrets and bindings
Request Request metadata and body, without the response body Changes where you need to see what was submitted
RequestResponse Request metadata, request body and response body Pods or workloads where the full exchange is required

Check that no one can escalate

An auditor will ask whether a team member can grant themselves more access. The RBAC page answers this with two rules. You can create or update a Role only if you already hold all of its permissions at the same scope, or if you hold the escalate verb on roles or clusterroles. You can create or update a RoleBinding only if you hold all the permissions of the referenced role at the same scope, or if you hold the bind verb on that role.

Your evidence should list the subjects that hold escalate or bind, alongside the Secret readers. A subject with bind on a powerful role can grant that role without holding it, so it belongs on the same list.

Evidence map for an auditor

This table maps common auditor questions to the Kubernetes object or log that answers each one. It is a starting point. Whether the mapping satisfies your standard is for you and your auditor to decide.

Auditor question Kubernetes source What to export Check
Who can read Secrets in one namespace? Role and RoleBinding in that namespace Roles with secrets rules, bindings that reference them, subjects Every subject from every binding in the namespace is listed
Who can read Secrets in every namespace? ClusterRoleBinding Bindings to ClusterRoles with secrets rules Group and service account subjects are included
Does an aggregated role grant more than its file says? ClusterRole with aggregationRule The rules field after aggregation The export is taken from the cluster, not from source
Who can grant access to others? escalate and bind verbs Subjects that hold either verb Each one is reviewed against the roles it could grant
What did a subject do with a Secret or binding? kube-apiserver audit log Events for those resources at Metadata or higher The policy level for the resource is recorded with the export

Gotchas from the docs

  • RBAC has no deny rules. Removing access means removing or changing a binding.
  • A RoleBinding that references a ClusterRole grants it only in the binding’s namespace.
  • roleRef cannot be edited after creation. Changing it means deleting the binding and creating a new one.
  • Aggregated ClusterRoles get their rules from the control plane, so a manual edit to rules does not stick.
  • Without --audit-policy-file, the page says no events are logged at all.

Keeping the evidence current

Run the export on a schedule and keep each run with its date, so the auditor sees how access changed over time. The related posts cover the rest of the evidence chain. How to collect Kubernetes compliance evidence for auditors covers collection and what a cluster scan cannot prove. How to document policy exceptions as audit evidence covers exceptions that grant access outside the normal rules. How to show Kubernetes Secrets are encrypted at rest covers the storage side of the same Secrets question. For the agent-specific case, read RBAC for AI agents in Kubernetes. The continuous compliance hub describes how Nirmata approaches compliance evidence on Kubernetes.

Frequently asked questions

Is a list of users with cluster access enough evidence for an auditor?

Usually not on its own. A user list does not show which role each user holds, which namespace that role covers, or whether a group or service account grants the same access. Export the Role, ClusterRole and binding objects with their subjects and roleRef, and show how each one maps to the access your standard covers.

Does Kubernetes RBAC have deny rules I can use to block a subject?

No. The RBAC page states that permissions are purely additive and that there are no deny rules. To remove access from a subject, delete or change the binding that grants it. Your evidence should therefore list every binding that can reach a resource, not only the ones meant to grant access.

What does the Metadata audit level record?

The audit page says the Metadata level logs events with metadata, such as the requesting user, timestamp, resource and verb, but not the request or response body. For Secrets, that means the log can show who made a call and when, without the Secret contents. Choose the level per resource in your audit policy.

Can someone who holds only the bind verb create a binding to a powerful role?

Yes, if that subject also holds the create verb on rolebindings, as the RBAC page's role-grantor example does. The RBAC page says you can create or update a RoleBinding when you hold all the permissions in the referenced role at the same scope, or when you are authorized to perform the bind verb on that role. Include every subject that holds bind or escalate in the access evidence, because either verb can extend access.

Ritesh Patel, Founder & VP Product, Nirmata

Ritesh Patel is a founder of Nirmata and leads its products. He writes about governing AI coding agents, MCP security and Kubernetes policy as code.

LinkedIn

Nirmata Control HubOne control plane for Kyverno policies.
Share

Stay up-to-date with the latest in AI, governance, and infrastructure

Subscribe to our free monthly newsletter to get industry news, DevOps tips, and articles right to your inbox on Kyverno, containerization, Kubernetes deployment & management and more.