Google Kubernetes Cluster
You secure a google kubernetes cluster by setting up Role-Based Access Control rules. These rules bind specific users or groups to clear permissions for namespaces and pods. Many teams start by giving developers broad cluster roles to speed up daily work. Broad roles let anyone read secrets or run commands in live production pods. One bad command or leaked key can break services across the whole cluster. How native roles work in a google kubernetes cluster Kubernetes uses its built-in authori
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 secure a google kubernetes cluster by setting up Role-Based Access Control rules. These rules bind specific users or groups to clear permissions for namespaces and pods. Many teams start by giving developers broad cluster roles to speed up daily work. Broad roles let anyone read secrets or run commands in live production pods. One bad command or leaked key can break services across the whole cluster.
How native roles work in a google kubernetes cluster
Kubernetes uses its built-in authorization API group to check every request to the API server. You turn on this mode on the API server to control user actions. Permissions in this system are purely additive. There are no deny rules at all. You must build access from the ground up for each team.
A standard Role sets rules inside a single namespace. A ClusterRole does not belong to one namespace. It can cover cluster-wide items like nodes or resources across all namespaces. It can also cover endpoints that do not map to standard resources.
After you define rules, you attach them to users with bindings. A RoleBinding grants access inside one specific namespace. It can point to a Role in that same namespace or a shared ClusterRole. A ClusterRoleBinding grants permissions across the entire cluster at once. Combining a ClusterRole with a RoleBinding lets teams reuse common rule sets safely.
Managing subresources like pod logs and exec sessions
Kubernetes RBAC names resources the exact same way they appear in the API URL. Some actions use a subresource attached to a main object. Reading pod logs or opening a shell inside a container uses a subresource. In your rules, you write the main resource and the subresource with a slash.
Teams often give engineers access to the log subresource for daily debugging. They also grant access to the exec subresource to fix broken containers. You can limitsome rules to specific objects by listing their resource names. Still, that name limit does not work when creating subresource requests. Once a user has exec rights in a namespace, they can enter many pods.
Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native setup solves and the gap it leaves open
Native roles and bindings do a good job of sorting users at the door. They let you separate production namespaces from test spaces. You can give read-only roles to most engineers and save write roles for admins. This setup stops unauthorized users from deleting workloads or changing cluster nodes.
Still, native RBAC only checks if a user can start an action. It decides who logs in, not what individual commands or requests do in flight. Once the API server allows an exec request, the user gets an open shell. Native rules do not inspect the shell commands that run inside that container. They also do not mask sensitive data like emails, phone numbers, or card numbers. If pod logs print national IDs, anyone with log access sees that raw text. Static bindings also stay active all day until an admin removes them.
Govern kubectl and API calls in flight
Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.
First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.
Frequently asked questions
Can I write a deny rule in Kubernetes RBAC?
No, permissions in Kubernetes RBAC are purely additive. You cannot write a deny rule to block one specific action. You must start with zero access and only grant the exact rules a user needs.
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding applies permissions inside one single namespace. A ClusterRoleBinding applies permissions across all namespaces and cluster-wide resources. You can link a RoleBinding to a ClusterRole to keep access inside one namespace.
How does Kubernetes control access to pod logs and shell sessions?
Kubernetes treats pod logs and exec sessions as subresources in the API URL. You must grant explicit access to the pods log or exec subresource in a role. Without those subresource rules, a user who can view pods still cannot read logs.
Related guides
In this post