Kubernetes OIDC Proxy
A kubernetes oidc proxy verifies user identity tokens before forwarding API requests to the cluster. It maps external identity groups to native cluster roles so engineers log in with single sign-on. Platform teams set this up to avoid sharing static client certificates across laptops. Still, broad role mappings often give developers wide permissions across every pod in a namespace. How a kubernetes oidc proxy works with native RBAC In a standard setup, the API server trusts an external identi
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 kubernetes oidc proxy verifies user identity tokens before forwarding API requests to the cluster. It maps external identity groups to native cluster roles so engineers log in with single sign-on. Platform teams set this up to avoid sharing static client certificates across laptops. Still, broad role mappings often give developers wide permissions across every pod in a namespace.
How a kubernetes oidc proxy works with native RBAC
In a standard setup, the API server trusts an external identity provider. A user logs in through their identity provider and receives a signed token. The client sends this token with each request to the cluster API server. The API server checks the token signature and reads the user and group claims.
Once the API server knows the user identity, native RBAC takes over. In Kubernetes, a Role or ClusterRole holds rules that represent a set of permissions. These permissions are additive, which means there are no deny rules in native RBAC. A Role always sets permissions within a single namespace. A ClusterRole is not namespaced and can cover cluster-scoped resources like nodes. It can also cover namespaced resources across all namespaces in the cluster.
To connect an OIDC user or group to those rules, teams create bindings. A RoleBinding grants permissions within one specific namespace. It can point to a Role in that namespace or a shared ClusterRole. A ClusterRoleBinding grants permissions across the entire cluster at once.
Managing subresources like pod logs and exec sessions
Engineers often need to read pod logs or run commands inside a container. Kubernetes RBAC refers to resources by the exact name in the API URL. Some APIs use a subresource, such as a pod log or exec endpoint. In RBAC rules, you write the subresource with a slash between the names. For example, rules can target the pods log endpoint or the pods exec endpoint.
Teams often try to lock down which pods a user can enter. Still, native RBAC has a specific limit on subresources. The resource name restriction on create actions applies only to top-level resources, not subresources. Because of this, you cannot restrict create actions on a subresource by resource name. If a user can run exec in a namespace, they can target any pod there.
Database Proxy (ProxySQL, PgBouncer) + Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native identity setup solves and what it leaves open
Linking an identity provider to Kubernetes solves the initial login problem. Teams no longer need to distribute long-lived static certificates to every new engineer. When someone leaves the team, disabling their single sign-on account stops their cluster login. RoleBindings also help teams split permissions by namespace rather than sharing one admin role.
Still, native OIDC and RBAC only decide who can open the door. Once the API server allows a pod exec request, RBAC steps out of the way. It does not inspect the shell commands an engineer runs inside that container. It also cannot mask sensitive fields like emails, phone numbers, or card numbers in output. If a container holds database keys, any allowed user can read them during a session. Teams need runtime controls to inspect commands and rewrite sensitive fields in results.
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 sits inline beside the API server as a sidecar for your Kubernetes API. For every production API call an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review alongside RBAC.
With hoop.dev Kubernetes controls, guardrails allow listing Secret names while refusing reads of Secret data before execution, and 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 Kubernetes RBAC deny a specific command inside a pod exec session?
No, native RBAC permissions are only additive and do not include deny rules. Once RBAC allows access to the exec subresource, it cannot filter individual shell commands.
What is the difference between a RoleBinding and a ClusterRoleBinding for OIDC groups?
A RoleBinding gives an OIDC group permissions inside one specific namespace only. A ClusterRoleBinding gives that group permissions across all namespaces and cluster-scoped resources.
Can a RoleBinding use a ClusterRole for namespace permissions?
Yes, a RoleBinding in a specific namespace can reference a ClusterRole. This grants the ClusterRole permissions to the user only within that single namespace.
Related guides
In this post