Onam
Containers

How does a ServiceAccount end up as cluster-admin? Kubernetes RBAC pitfalls with kubectl checks

By Poonam Yadav, Head of Engineering•June 10, 2026•Updated November 27, 2026•4 min read

Would rather we looked for you? We run a free one-time audit scan of one cloud account and go through the results with you. No charge, no commitment.

Free audit scan

How does a default ServiceAccount end up as cluster-admin? Usually through an ordinary-looking grant: a ClusterRoleBinding where a RoleBinding was meant, a binding to a system: group, a wildcard, the right to create pods, or a verb such as bind that grants more verbs. Each of the six patterns below comes with a read-only kubectl check you can run today.

Updated 27 November 2026: added copy-paste audit commands for each pattern and current Onam coverage.

Kubernetes RBAC looks simple: roles list verbs on resources, bindings attach roles to subjects. The trouble is that several grants are equivalent to cluster-admin once you follow what they allow, and each is easy to miss in a review that reads roles one at a time. The commands below need kubectl with read access to RBAC objects and jq. RBAC object fields are from the Kubernetes RBAC documentation (accessed 27 November 2026).

1. A ClusterRoleBinding where a RoleBinding was meant

A ClusterRole can be bound in two ways. A RoleBinding grants its rules inside one namespace; a ClusterRoleBinding grants them in every namespace and on cluster-scoped resources. Teams often reuse a ClusterRole such as edit and bind it with a ClusterRoleBinding by habit, turning "can edit the payments namespace" into "can edit every namespace".

Audit: list every ClusterRoleBinding and ask, for each, whether the subject genuinely needs cluster-wide scope. Start with the ones that hand out cluster-admin:

kubectl get clusterrolebindings -o json | jq -r '.items[] | select(.roleRef.name=="cluster-admin") | .metadata.name + " -> " + ([.subjects[]? | .kind + ":" + .name] | join(", "))'

2. Bindings to broad groups

Subjects such as system:authenticated (every authenticated identity) or system:serviceaccounts (every service account) appear in bindings created for convenience during setup. Anything granted to them is granted to every workload and user in the cluster.

Audit: search bindings for group subjects that start with system: and justify each one. Built-in bindings (for example system:basic-user and system:discovery) will appear; anything else needs a reason:

kubectl get rolebindings,clusterrolebindings -A -o json | jq -r '.items[] | select(any(.subjects[]?; .kind=="Group" and (.name | startswith("system:")))) | (.metadata.namespace // "cluster") + "/" + .metadata.name'

3. Wildcards

verbs: ["*"] or resources: ["*"] in a custom role grants everything that exists today and everything a future CRD adds tomorrow. A wildcard on resources in the core API group includes secrets.

Audit: treat any wildcard outside the built-in cluster-admin role as a finding until proven necessary:

kubectl get clusterroles,roles -A -o json | jq -r '.items[] | select(any(.rules[]?; ((.verbs // []) | index("*")) or ((.resources // []) | index("*")))) | (.metadata.namespace // "cluster") + "/" + .metadata.name'

4. Pod creation rights that reach the node

A subject that can create pods in a namespace can run a pod that mounts the node's filesystem through a hostPath volume, runs privileged, or uses any service account in that namespace, and so inherits that service account's permissions. Unless Pod Security admission (or an equivalent policy) blocks privileged and host-path pods in that namespace, "create pods" is a path to the node and from there, often, to the cluster.

Audit: list who can create pods, deployments, jobs and other workload controllers, and confirm the namespace enforces the restricted or baseline Pod Security standard. Check one identity, then every namespace's enforcement label:

kubectl auth can-i create pods -n payments --as=system:serviceaccount:payments:default
kubectl get namespaces -L pod-security.kubernetes.io/enforce

An empty value in the ENFORCE column means no Pod Security level is enforced on that namespace. See kubectl auth can-i and Pod Security admission (accessed 27 November 2026).

5. Verbs that grant more verbs

Some permissions exist to manage permissions. escalate lets a subject create roles with rules it does not hold; bind lets it bind roles it does not hold; impersonate lets it act as another user, group or service account. create on serviceaccounts/token mints tokens for other identities, and read access to secrets exposes whatever credentials the namespace stores.

Audit: search every role for escalate, bind, impersonate, serviceaccounts/token and secrets, and treat each as admin-adjacent. The first three verbs:

kubectl get clusterroles,roles -A -o json | jq -r '.items[] | select(any(.rules[]?; (.verbs // []) | any(. == "escalate" or . == "bind" or . == "impersonate"))) | (.metadata.namespace // "cluster") + "/" + .metadata.name'

6. Aggregated roles that grow on their own

ClusterRoles with an aggregationRule collect the rules of every ClusterRole carrying a matching label. The built-in admin, edit and view roles work this way, so installing an operator whose ClusterRoles carry those labels quietly widens what everyone bound to edit can do.

Audit: after installing an operator or CRD, diff the effective rules of admin, edit and view against what they held before:

kubectl get clusterrole edit -o jsonpath='{.rules}' > edit-before.json
# install the operator, then:
kubectl get clusterrole edit -o jsonpath='{.rules}' > edit-after.json
diff edit-before.json edit-after.json

A habit that catches most of this

Review RBAC as effective access per subject rather than as a list of roles. For each service account and group, ask what it can do across the whole cluster once every binding is counted:

kubectl auth can-i --list --as=system:serviceaccount:<namespace>:<serviceaccount>

The six patterns above are the usual reasons the answer is "more than anyone intended".

Where Onam fits

Onam's container security checks Kubernetes clusters against posture rules, including RBAC and Pod Security settings, alongside the cloud accounts the clusters run in. It has 1,023 Kubernetes rule definitions, and not every definition is a working check yet. Its shadow-admin detection covers the Kubernetes patterns above that grant more than they look: bind and escalate, impersonate, and pod creation with a privileged service account. Kubernetes posture needs Onam's read access inside the cluster, so it is on the paid plans rather than the free plan.

Frequently asked questions

How do I find who has cluster-admin in Kubernetes?

List the ClusterRoleBindings whose roleRef is cluster-admin and print their subjects with kubectl get clusterrolebindings -o json and a jq filter, then check groups starting with system: separately.

What can a ServiceAccount do in my cluster?

Run kubectl auth can-i --list --as=system:serviceaccount:<namespace>:<name>. It lists the actions that identity is allowed, after every binding is counted.

Why is pod creation dangerous in Kubernetes RBAC?

A subject that can create pods can run one that mounts the node's filesystem, runs privileged or uses any service account in the namespace, unless Pod Security admission blocks it.

Try it on your own cloud

Start free. The free plan covers up to 25 units of cloud security, with API-based scanning only: posture (CSPM), identity and permissions (CIEM), data stores found through cloud APIs (DSPM checks, no content classification) and AI-SPM. Posture scanning connects through read-only cloud roles, the free plan deploys no agent or scanner, and no card is needed. Register, and the team emails you the login.

Start free · Book a demo

See this on your own cloud, free

The free plan covers up to 25 units of cloud security with read-only cloud API scanning. It deploys no agent or scanner and needs no card. Register, and the team emails you the login.