GKE Cluster

Published
Length
3 min read

Luis Felipe Dias

All posts

A gke cluster runs container workloads using Kubernetes API rules to control user permissions. You secure it by setting up specific roles and binding them to team identities. Many teams start by giving broad cluster roles to speed up daily work. This habit creates big risks when one developer account gets stolen or runs a bad command. Overly broad roles let users read secrets or delete whole namespaces by mistake. You need tight rules that match each person's real job. How gke cluster permissi

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.

A gke cluster runs container workloads using Kubernetes API rules to control user permissions. You secure it by setting up specific roles and binding them to team identities. Many teams start by giving broad cluster roles to speed up daily work. This habit creates big risks when one developer account gets stolen or runs a bad command. Overly broad roles let users read secrets or delete whole namespaces by mistake. You need tight rules that match each person's real job.

How gke cluster permissions work in Kubernetes

Kubernetes uses Role-Based Access Control, known as RBAC, to check every API call. First, you turn on the RBAC mode on the API server. In this system, permissions are purely additive, which means there are no deny rules. You start with zero access and add rules one by one.

A Role sets permissions inside one single namespace. For example, you can let a developer team read pods only in their staging namespace. A ClusterRole is different because it is not tied to one namespace. It can cover cluster-wide items like nodes, or resources across all namespaces.

After you write a Role or ClusterRole, you must attach it to a user. A RoleBinding grants those permissions inside one specific namespace. A RoleBinding can point to a local Role or a shared ClusterRole. When a user needs permissions across every namespace, you use a ClusterRoleBinding instead.

RBAC also controls subresources, which appear with a slash in the API path. Common examples include pod logs and pod exec calls. If you grant a role the pod exec subresource, that user can open a shell inside running containers. You must separate normal pod read rules from exec rules to keep workloads safe.

What native roles solve and what they miss

Native RBAC does a great job deciding who can talk to the API server. You can limit which teams view namespaces, deploy apps, or open container shells. It stops random users from changing cluster nodes or reading other teams' configs.

Still, native RBAC stops checking once the API call starts. If a role allows pod exec, the cluster lets the user open a shell session. RBAC cannot see or filter the shell commands the user runs inside that pod. It also cannot rewrite sensitive data like emails, phone numbers, or card numbers in log outputs.

GKE Workload Identity: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

The same gap happens when engineers debug live apps or read pod logs. Native permissions are all-or-nothing for each resource and verb. Once a user has permission to run exec or read logs, every output flows back raw. Teams also struggle to link individual shell commands back to a specific ticket or approval. Relying only on static roles leaves daily container sessions unchecked while they run.

Steps to tighten your role bindings

Start by auditing all your current ClusterRoleBindings. Remove broad cluster-wide bindings from human users whenever you can. Move developers to namespace-scoped RoleBindings so mistakes stay inside one area.

Next, split your read roles from your action roles. Create a basic role that only views pod status and events. Keep pod exec and secret reading in a separate role for urgent fixes. Because Kubernetes has no deny rules, keeping base roles tiny is the safest path. Review these bindings often to make sure old accounts do not keep active roles.

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 sits inline as an open-source proxy, a sidecar for your Kubernetes API, without replacing RBAC. On every production call from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run or hold risky deletes for review. 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

What is the difference between a Role and a ClusterRole in a gke cluster?

A Role applies only to one namespace. A ClusterRole applies across the whole cluster and can cover nodes or all namespaces at once.

Can I write a deny rule in Kubernetes RBAC?

No, Kubernetes RBAC rules are purely additive. Users start with no permissions, and every binding only adds new allowed actions.

How do I stop users from opening shells in pods?

Remove the pods exec subresource from their assigned Role or ClusterRole. This lets them check pod status without running commands inside the container.

The query runs. The emails stay hidden.