Openshift Cluster Roles

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openshift cluster roles by grouping API rules and binding them to users. These cluster-wide objects grant rights across all namespaces or on shared cluster nodes. Most platform teams start with built-in admin or edit roles to move fast. Broad permissions soon let one mistake or bad command harm every running app. Tight role design keeps daily cluster work safe and limits the blast radius. How openshift cluster roles work in the cluster OpenShift builds its permission model on stand

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 openshift cluster roles by grouping API rules and binding them to users. These cluster-wide objects grant rights across all namespaces or on shared cluster nodes. Most platform teams start with built-in admin or edit roles to move fast. Broad permissions soon let one mistake or bad command harm every running app. Tight role design keeps daily cluster work safe and limits the blast radius.

How openshift cluster roles work in the cluster

OpenShift builds its permission model on standard Kubernetes role-based access control rules. Every role holds a list of rules that grant specific API actions. Rules are purely additive, which means there are no deny rules at all. If a user lacks a rule, the API server blocks the request.

A standard role only sets permissions inside one single namespace. In contrast, a cluster role is not tied to any single namespace. It can control cluster-scoped resources like nodes or non-resource endpoints. It can also control namespaced objects like pods across the whole cluster.

Creating the role itself does not give anyone power right away. You must attach the role to a user, group, or service account. A cluster role binding grants those permissions across the entire cluster at once. You can also reference a cluster role inside a single namespace role binding. That trick lets teams reuse one central rule template inside many separate projects.

Where native role bindings fall short in live operations

Native role bindings do a great job of checking who can call an API. The API server checks the user identity and matches it against bound rules. It also checks subresources like pod logs or pod exec requests by name. This stops unauthorized users from opening a shell or reading logs.

Still, a role check happens only when the API request first arrives. Once a user gets pod exec rights, the native role steps aside. The cluster role cannot see what shell commands the engineer runs inside the container. It also cannot mask sensitive fields like emails or card numbers in output.

OpenShift RBAC + Lambda Execution Roles: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Also, additive rules make temporary tasks hard to manage at scale. Platform teams often grant broad cluster roles during an outage to fix things fast. Those bindings stay active long after the incident ends unless someone removes them. Over time, too many people keep permanent shell access to production containers.

Practical steps to tighten cluster permissions

Start by auditing every cluster role binding that points to human users. Move engineers away from cluster-wide bindings whenever they only work in a few projects. Use a namespace role binding that points to a shared cluster role instead. This keeps your rule definitions dry while scoping rights to one namespace.

Separate read permissions from interactive shell permissions in your custom role definitions. Viewing pod status or reading pod logs is safe for most developers. Opening an exec session inside a running container carries much higher risk. Keep pod exec rules in a separate role reserved for specific tasks.

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

What is the difference between a role and a cluster role?

A role applies rules inside one single namespace only. A cluster role applies rules to cluster-wide objects or across all namespaces.

Can I add a deny rule to block one specific namespace?

No, role permissions are purely additive and never support deny rules. To block access, remove the cluster binding and use namespace bindings instead.

How do I reuse a cluster role for one project team?

Create a standard role binding inside that team's specific namespace. Point that binding to the cluster role so the rules apply locally.

The query runs. The emails stay hidden.