How to Configure OpenShift RBAC

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up openshift rbac, you define roles with rules and bind them to users. These rules grant additive permissions to cluster resources or specific namespaces. Teams often start by assigning broad cluster roles so engineers can debug apps fast. When roles stay too broad, one person or script can change critical workloads across namespaces. Over time, shared cluster permissions make it hard to track who ran specific actions. How openshift rbac works with roles and bindings The permission mod

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 openshift rbac, you define roles with rules and bind them to users. These rules grant additive permissions to cluster resources or specific namespaces. Teams often start by assigning broad cluster roles so engineers can debug apps fast. When roles stay too broad, one person or script can change critical workloads across namespaces. Over time, shared cluster permissions make it hard to track who ran specific actions.

How openshift rbac works with roles and bindings

The permission model uses the native Kubernetes authorization API group on the API server. Every rule in this system is additive, which means there are no deny rules. You start with zero permissions and add rules for each needed action and resource.

A Role sets permissions inside one single namespace. A ClusterRole is not namespaced and works across the whole cluster. You can use a ClusterRole for cluster resources like nodes or for endpoints. You can also use a ClusterRole for namespaced resources across all namespaces at once.

To give those permissions to a user or team, you create a binding. A RoleBinding grants permissions inside one specific namespace. That RoleBinding can point to a Role in the same namespace. A RoleBinding can also point to a global ClusterRole to reuse common rules. When you bind a ClusterRole with a RoleBinding, the user only gets local permissions. A ClusterRoleBinding grants permissions across the entire cluster at once.

Managing subresources and namespace scope

The API server names resources using the exact words from the API URL. Many common day-to-day actions use subresources instead of top-level objects. In role rules, you write a subresource by adding a slash after the resource. For example, reading pod logs uses the pods and log subresource name. Running commands inside a container uses the pods and exec subresource name.

Platform teams often try to limit roles to specific resource names. Still, the resource name filter on create calls only applies to top-level resources. It does not restrict subresources in the same way during creation. If you grant broad subresource rules, users can interact with every pod in that namespace. Good role design keeps cluster bindings rare and relies on local namespace bindings instead.

OpenShift RBAC + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native permissions solve and what they miss

Native role bindings do a great job of checking who can call the API. The API server checks the user identity and role before allowing any request. This setup blocks unauthorized users from listing pods, reading secrets, or deleting deployments. It gives teams a clear way to separate duties between staging and prod namespaces.

Still, native roles only check the initial API call, not what happens inside it. Once a user has permission for the pod exec subresource, they can open a shell. The API server allows the shell to start, and then its job is done. It does not inspect individual shell commands or database queries run inside that container. If a pod holds app keys or database credentials, the user can use them freely. Native role rules also cannot rewrite sensitive fields like emails, phone numbers, or card numbers. When engineers inspect live pod logs or run debug commands, raw data prints in full. Teams need runtime controls to approve sensitive actions and mask data 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 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 I write a deny rule in openshift rbac?

No, all permissions in the role system are additive. To block an action, you must remove the role binding that grants that permission.

When should I use a RoleBinding with a ClusterRole?

Use this pattern when you want one standard set of rules across many projects. The ClusterRole holds the rules, and each RoleBinding limits those rules to one namespace.

How do I let developers read pod logs without giving shell access?

Create a Role that grants permission to the pod log subresource only. Do not include the pod exec subresource in that role rule.

The query runs. The emails stay hidden.