Openshift Rolebinding

Published
Length
3 min read

Luis Felipe Dias

All posts

An openshift rolebinding links a user or group to a role inside one namespace. You set up this link to grant exact permissions for resources in that single project. Teams often start by binding broad cluster roles to speed up daily work. When permissions are too wide, one mistake can break live workloads or expose secret data. How an openshift rolebinding works in your cluster Role-based access control runs on the API server to check every request. A role holds a set of rules that define allo

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.

An openshift rolebinding links a user or group to a role inside one namespace. You set up this link to grant exact permissions for resources in that single project. Teams often start by binding broad cluster roles to speed up daily work. When permissions are too wide, one mistake can break live workloads or expose secret data.

How an openshift rolebinding works in your cluster

Role-based access control runs on the API server to check every request. A role holds a set of rules that define allowed actions. All rules are additive, which means there are no deny rules in the system. You start with zero access and add rules for each needed action.

A standard role always sets permissions inside one single namespace. A cluster role is not limited to a single namespace. It can cover cluster-wide items like nodes, or resources across all namespaces. An openshift rolebinding grants access inside one specific namespace only.

Your binding can point to a local role in that same namespace. It can also point to a broad cluster role. When you bind a cluster role with a local binding, the user gets those permissions only inside that one namespace. This lets admins write one standard role and reuse it across many team projects.

Rules also cover subresources like pod logs or pod exec sessions. The API names these items by adding a slash between the resource and subresource. Admins must grant access to these subresources if engineers need to read logs or run commands inside containers.

Choosing between local and cluster bindings

Teams must choose between a namespace binding and a cluster-wide binding. A cluster role binding grants permissions across the entire cluster at once. If you bind a user to an admin role at the cluster level, they can change any project.

Most teams avoid cluster bindings for daily engineering work. Instead, they create a local binding in each project namespace. This limits the blast radius if an account key leaks or an engineer runs a bad command. You can give a developer write access in a test project and read access in production.

K8s RoleBinding vs ClusterRoleBinding + OpenShift RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, managing hundreds of bindings across many projects takes significant time. Teams often group users into identity provider groups first. Then they bind the group to the role instead of listing single users. When a person leaves the team, removing them from the group revokes their project access right away.

What native bindings solve and where gaps remain

Native role bindings solve the problem of who can call specific API endpoints. The API server checks the user identity and the binding rules before allowing an action. If a user lacks the pod exec permission, the server blocks them from opening a shell.

Still, native bindings only check access at the start of the request. Once a binding lets an engineer open a container shell, the role cannot filter what happens inside. The engineer can run any binary, read local files, or query connected backend stores.

The same gap exists when engineers read pod logs or pull project secrets. Native rules decide if the user can read the log stream at all. They do not inspect the data inside that stream. If an app prints customer emails, phone numbers, or card numbers to the log, the reader gets raw text.

Native bindings are also static once an admin applies them to the namespace. They stay active until someone deletes the binding object. Teams that need temporary access for a quick fix must remember to delete the binding later. Forgotten bindings leave standing privileges open across production projects.

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 an openshift rolebinding deny a specific permission?

No, role rules are purely additive and never include deny rules. To block an action, you must remove the rule or delete the binding that grants it.

Can a local rolebinding reference a cluster role?

Yes, a local binding can point to a cluster role. The user then receives those cluster role permissions only within the single namespace of the binding.

How do role bindings control container shell access?

Admins include the pod exec subresource in the role rules and bind that role to the user. This grants permission to open a shell inside namespace pods, though it does not filter the commands run inside.

The query runs. The emails stay hidden.