Si GKE

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up si gke permissions, bind Kubernetes roles to specific user identities. You control cluster actions by defining additive role rules for each namespace. Teams often start by granting broad cluster roles to speed up daily work. When roles are too broad, users can run risky commands across every namespace. Overly wide permissions also let engineers read secret keys they do not need. A good setup scopes rules down to single namespaces and specific pod tasks. How to set up si gke role rule

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.

To set up si gke permissions, bind Kubernetes roles to specific user identities. You control cluster actions by defining additive role rules for each namespace. Teams often start by granting broad cluster roles to speed up daily work. When roles are too broad, users can run risky commands across every namespace. Overly wide permissions also let engineers read secret keys they do not need. A good setup scopes rules down to single namespaces and specific pod tasks.

How to set up si gke role rules

A si gke setup relies on standard Kubernetes role-based access control rules. You enable this control mode right on the Kubernetes API server. Every Role or ClusterRole holds a list of rules that grant permissions. In Kubernetes, all permission rules are purely additive. There are no deny rules in this system. You start with zero access and add allowed actions one by one.

A standard Role always sets permissions inside a single namespace. A ClusterRole does not belong to one single namespace. Instead, it covers cluster-wide items like nodes or spans across all namespaces. It can also cover endpoints that are not tied to standard resources.

After you write a role, you must attach it to a user. A RoleBinding grants those permissions inside one specific namespace. That binding can point to a local Role in the same namespace. It can also point to a shared ClusterRole to save time. When a RoleBinding points to a ClusterRole, the user only gets local access. If a user needs access across the whole cluster, use a ClusterRoleBinding. That binding applies the rules to every namespace at once.

You also need to control subresources like pod logs and command sessions. The API server names resources using the exact path in the API URL. Subresources use a slash format to separate the main item and the subresource. For example, reading pod logs uses the pods and log subresource path. Running a shell inside a container uses the pods and exec subresource path. You must add these subresource paths to your role rules to allow access.

What native roles solve and what they miss

Native roles are great at deciding who can talk to the API server. They let you split teams by namespace and block unauthorized API calls. You can allow one team to view pod logs while blocking another team. This stops accidental changes to clusters that a team does not own.

GKE Workload Identity: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, native roles leave a big operational gap during live debugging sessions. First, restricting specific resource names on create calls only works on top-level resources. It does not apply to subresources in the same way. Second, role bindings only check permissions when a user starts a request. Once a user opens an exec session, Kubernetes stops checking individual commands. The API server knows who started the session, not what commands run inside. It also does not inspect or mask sensitive output returned in pod logs. If a log prints card numbers or emails, the user sees everything. Native roles control who gets in, not what happens inside the shell.

How to audit and scope pod subresources

To keep clusters safe, split read rules from interactive shell rules. Give most engineers a role that only allows reading pod status and logs. Put the exec subresource in a separate role meant for active fixes. Bind that higher role only to specific namespaces where the team works. Avoid using cluster-wide bindings for human users whenever you can.

Review your bindings often to make sure old roles do not linger. Check which groups hold exec rights across your key namespaces. Keep role definitions small and focused on one clear job per role. When teams need deeper control over live commands, native roles are not enough. You must pair role rules with controls that watch commands in flight.

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

Can I write a deny rule in a si gke role?

No, Kubernetes roles do not support deny rules at all. All permissions are purely additive, so you only list what is allowed.

What is the difference between a RoleBinding and a ClusterRoleBinding?

A RoleBinding grants permissions inside one single namespace. A ClusterRoleBinding grants permissions across the entire cluster and all of its namespaces.

How do I let users read pod logs without full pod access?

Create a Role that targets the pods log subresource using a slash. Bind that Role to the user inside the target namespace.

The query runs. The emails stay hidden.