GitHub SSO for Kubernetes GKE

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up github sso for kubernetes gke by linking GitHub identities to cluster roles. This lets your team log in with their daily code accounts. Most teams map GitHub groups to cluster permissions so engineers can check pods and read logs. Still, broad role bindings often grant far too much power across the whole cluster. A single wide role can let an engineer change live apps or read private keys. How github sso for kubernetes gke works in practice Kubernetes does not store user accounts i

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 github sso for kubernetes gke by linking GitHub identities to cluster roles. This lets your team log in with their daily code accounts. Most teams map GitHub groups to cluster permissions so engineers can check pods and read logs. Still, broad role bindings often grant far too much power across the whole cluster. A single wide role can let an engineer change live apps or read private keys.

How github sso for kubernetes gke works in practice

Kubernetes does not store user accounts inside the cluster by default. Instead, it trusts an outside identity service to check who a user is. When you link GitHub to Google Kubernetes Engine, GitHub checks the user login. Then, the cluster checks what that specific user or team can do. This step uses native Kubernetes role-based access control, known as RBAC.

In RBAC, a Role sets permissions inside one single namespace. A ClusterRole sets permissions across the whole cluster, including nodes and all namespaces. You then connect your GitHub teams to these roles. A RoleBinding gives a team permissions inside one namespace. A ClusterRoleBinding gives a team permissions across the entire cluster.

All rules in Kubernetes RBAC are purely additive. There are no deny rules in this system. You start with zero access and add rules for each resource and verb. If you bind a GitHub team to a ClusterRoleBinding, those users gain wide reach. Good setups use small RoleBindings limited to the one namespace a team owns.

Why native roles leave a gap during live work

Linking GitHub to GKE solves the first big problem of cluster security. You no longer share static cluster keys on developer laptops. When someone leaves your GitHub group, they lose their cluster login right away. You also get a clear map of which teams can reach which namespaces.

Still, native RBAC only checks who logs in and which API resource they touch. It does not inspect what happens inside an active shell or command. In Kubernetes, pod logs and pod exec are subresources of a pod. When you grant a user the pod exec rule, they can open a shell. Once inside that container, RBAC stops checking what they type.

Kubernetes RBAC + GKE Workload Identity: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

An engineer in a debug shell can run any tool installed in that image. They can query a local database or print raw data to their screen. Standard cluster audit logs show that the user opened an exec session. They do not show the commands run inside that shell or the output returned.

Tightening control over cluster commands and secrets

This gap matters most during live incidents and production fixes. To fix a broken app, an engineer often needs pod exec or secret read rules. Because RBAC has no deny rules, you cannot easily block one bad command. You either give the user full shell access to the pod or none at all.

Reading logs or checking app states can also expose private customer data. A pod log might print emails, phone numbers, card numbers, or national IDs. Native GKE roles cannot rewrite matched fields in results before they reach the screen. Teams need a way to approve single actions and filter sensitive output in flight.

Add request guardrails and response masking beside Kubernetes

Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.

With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. Data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.

Frequently asked questions

Can I deny one specific command with Kubernetes RBAC?

No, Kubernetes RBAC permissions are purely additive and have no deny rules. Once a role grants pod exec access, RBAC cannot block specific shell commands inside the container.

Should I use a RoleBinding or a ClusterRoleBinding for GitHub teams?

Use a RoleBinding for most teams because it keeps permissions inside one single namespace. Save ClusterRoleBindings for platform admins who must manage nodes or resources across all namespaces.

Does GKE log every command typed inside a pod exec session?

Native cluster audit logs record the API request that starts the pod exec subresource call. They do not capture the interactive shell commands or screen output that follow.

The query runs. The emails stay hidden.