Runtime Identity for Kubernetes
You set up runtime identity for kubernetes by binding users and apps to native roles. These roles check every API request before a pod or user runs a task. Most teams start by grouping users into broad cluster roles to speed up work. When roles are too broad, one person or pod can change too many namespaces. A small mistake or stolen key can then harm the whole cluster at once. How runtime identity for kubernetes works with native RBAC Kubernetes checks identity and permissions through its bu
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 runtime identity for kubernetes by binding users and apps to native roles. These roles check every API request before a pod or user runs a task. Most teams start by grouping users into broad cluster roles to speed up work. When roles are too broad, one person or pod can change too many namespaces. A small mistake or stolen key can then harm the whole cluster at once.
How runtime identity for kubernetes works with native RBAC
Kubernetes checks identity and permissions through its built-in Role-Based Access Control system. You turn this system on at the API server to guard cluster resources. Every rule in this system is additive, which means there are no deny rules. You start with zero permissions and add rules for each action a user needs.
A Role holds a list of rules that apply inside one single namespace. If you need rules across the whole cluster, you make a ClusterRole instead. A ClusterRole can guard cluster-wide items like nodes or span across all namespaces. It can also cover endpoints that are not tied to standard cluster resources.
Once you write a role, you link it to an identity with a binding. A RoleBinding gives a user or pod permissions inside one specific namespace. That RoleBinding can point to a local Role or a shared ClusterRole. You can reuse one ClusterRole across many teams by making local RoleBindings in each namespace. If someone truly needs cluster-wide reach, you link them with a ClusterRoleBinding instead.
What native roles solve and where runtime gaps remain
Native roles are great at deciding who can reach the Kubernetes API server. You can even set rules for subresources like pod logs or pod exec sessions. In RBAC rules, you write these subresources with a slash after the main resource. This lets you allow log reading while blocking shell access to a running pod.
Still, native RBAC stops checking once the API server approves the initial request. If a user gets pod exec rights, Kubernetes does not check the commands inside. The user can run any shell command that the container user is allowed to run. Also, name filters on create actions only work on top-level resources, not subresources.
Kubernetes RBAC + Identity and Access Management (IAM): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
This leaves a big gap during live fixes and daily support tasks. Native roles decide who can open a shell or read a secret object. They do not inspect single commands in flight or mask sensitive fields in results. If a log stream prints emails, phone numbers, or card numbers, the user sees them. Teams need a way to check every command and rewrite sensitive fields like national IDs.
Best practices for scoping cluster permissions
Start by giving each app and team member a role inside one namespace. Avoid ClusterRoleBindings unless a tool must read nodes or manage every namespace at once. Split read roles from write roles so daily checks do not carry update rights. Keep pod exec and secret read rules separate from basic pod viewing roles. Review your bindings often to remove old accounts and tighten wide rules.
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 proxy, a sidecar for your Kubernetes API, inline on the API connection. On every kubectl or API call an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
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, or hold risky calls for approval. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs in memory. View the project on GitHub.
Frequently asked questions
Can I write a deny rule in Kubernetes RBAC to block one specific command?
No, Kubernetes RBAC permissions are purely additive and do not support deny rules. You must grant only the exact resource and subresource rules a user needs. Native RBAC also cannot inspect or block individual shell commands inside an exec session.
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding grants permissions inside one namespace, even if it references a ClusterRole. A ClusterRoleBinding grants permissions across the entire cluster and all of its namespaces. Use a RoleBinding whenever a team or app only works in one namespace.
How does Kubernetes control access to pod logs and exec sessions?
Kubernetes treats pod logs and exec sessions as subresources written with a slash. You must add explicit rules for pods/log or pods/exec inside a Role or ClusterRole. Without those subresource rules, a user who can view pods still cannot open a shell.
Related guides
In this post