Kubernetes Group
You set up a kubernetes group by linking your identity provider to cluster RBAC bindings. The cluster reads group claims from login tokens and matches them to role rules. Many teams start by mapping broad engineering groups to wide cluster roles. This quick fix gives too many people the power to change live workloads. Over time, broad roles create big security risks across all your shared namespaces. How a kubernetes group works with native RBAC Kubernetes does not have a built-in object for
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up a kubernetes group by linking your identity provider to cluster RBAC bindings. The cluster reads group claims from login tokens and matches them to role rules. Many teams start by mapping broad engineering groups to wide cluster roles. This quick fix gives too many people the power to change live workloads. Over time, broad roles create big security risks across all your shared namespaces.
How a kubernetes group works with native RBAC
Kubernetes does not have a built-in object for user or group records. Instead, the API server reads the kubernetes group name from an external login token. Your identity provider puts these group names inside the token during login. Once the API server checks the token, it looks at your RBAC rules.
RBAC rules are additive, which means there are no deny rules in the system. A Role sets permissions inside one single namespace for your team. A ClusterRole sets permissions across the whole cluster, including nodes and all namespaces. You link a group to these roles using a RoleBinding or a ClusterRoleBinding.
A RoleBinding grants permissions inside one namespace by pointing to a Role or ClusterRole. A ClusterRoleBinding grants permissions across the entire cluster at once. When a user runs a command, the API server checks their group bindings. If a binding matches the request, the API server lets the action run.
Scoping subresources and namespace permissions
Teams often use groups to split permissions between dev and prod namespaces. You can bind a developer group to a Role in a test namespace. That same group might only get read rules in a live namespace. This keeps daily work separate from critical systems.
RBAC also controls subresources like pod logs and pod exec sessions. In RBAC rules, you write a subresource using a slash, like pods and log. If you grant the pods exec subresource, anyone in that group can open a shell. They can run commands inside any container in that namespace.
Because RBAC has no deny rules, you cannot block one specific pod easily. Adding a user to a second group only adds more permissions to their profile. Teams must keep group rules very small from the start. Otherwise, people end up with extra rights they do not need.
Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native group bindings solve and what they miss
Mapping a kubernetes group to RBAC roles solves user lifecycle management. When someone joins or leaves a team, you update your identity provider once. You do not need to edit cluster bindings for every single person. The cluster knows which group can view pods or edit deployments.
Still, native RBAC only checks who can start an API call. It does not inspect what happens inside an active pod exec session. Once a group member opens a container shell, RBAC steps out of the way. The cluster cannot block dangerous shell commands or rewrite sensitive output in flight.
If an app prints emails, phone numbers, or card numbers, the user sees them. Native RBAC cannot rewrite matched fields in results from a pod log stream. It also cannot require a quick peer check before someone runs a single command. Teams need deeper controls to manage what happens after the initial role check passes.
Check Kubernetes API requests and responses on the wire
Kubernetes RBAC decides who may call the API server. RBAC does not check response payloads or split listing Secret names from reading Secret values when a role grants get access. With hoop.dev, you run an open-source HTTP proxy, a sidecar for your Kubernetes API. The kubectl client changes only the server address it talks to while RBAC stays in place.
On each call, hoop.dev guardrails read the method, normalized path, and headers to refuse bad deletes or full Secret reads with a 403 error. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs. Every request and verdict is logged without storing bearer tokens. View the project on GitHub.
Frequently asked questions
How do you create a kubernetes group inside the cluster?
You do not create a group object inside the cluster itself. You create the group in your identity provider and reference its name in a RoleBinding.
Can you add a deny rule to a kubernetes group binding?
No, Kubernetes RBAC permissions are purely additive and have no deny rules. To limit a group, you must remove permissions from its Role or ClusterRole.
When should a group use a RoleBinding instead of a ClusterRoleBinding?
Use a RoleBinding when a group only needs permissions inside one specific namespace. Use a ClusterRoleBinding when the group needs permissions across all namespaces or on nodes.
Related guides
In this post