How to Configure OpenShift Read Only Access
You set up openshift read only access by binding users to a view role. This setup uses standard Kubernetes role rules to allow reading without writing. Teams often share broad cluster roles so developers can check app logs fast. Broad roles let users edit live workloads or read sensitive keys by mistake. A strict read role stops unwanted changes while letting engineers inspect pod states. How openshift read only access works with roles OpenShift uses the core Kubernetes role system to control
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 read only access by binding users to a view role. This setup uses standard Kubernetes role rules to allow reading without writing. Teams often share broad cluster roles so developers can check app logs fast. Broad roles let users edit live workloads or read sensitive keys by mistake. A strict read role stops unwanted changes while letting engineers inspect pod states.
How openshift read only access works with roles
OpenShift uses the core Kubernetes role system to control what users can do. In this system, all rules are additive, and there are no deny rules. You start with zero rights and add only the safe read actions needed. Two main role types exist to hold these sets of read permissions. A standard Role sets permissions inside one single namespace or project. A ClusterRole is not namespaced and can cover resources across the whole cluster. It can also cover cluster-wide items like nodes and non-resource endpoints.
To give a user these rights, you must create a binding object. A RoleBinding grants permissions inside one specific namespace to a user or group. That RoleBinding can point to a local Role in that same namespace. It can also point to a shared ClusterRole to save admin work. When you bind a ClusterRole with a RoleBinding, it works in one namespace. If a user needs a full cluster view, you use a ClusterRoleBinding instead. A ClusterRoleBinding grants the read permissions across every namespace in the cluster.
Managing subresources and secret rules in view roles
Read roles must also handle subresources like pod logs to be useful. The role system names resources the exact same way the API URL does. Subresources use a slash in the rule name to separate the parts. For example, reading pod output requires permission on the pods and log path. Without that subresource rule, a user can see a pod but not its logs. Admins must also watch out for container execution subresources when building roles. If a role allows create actions on the exec subresource, users can run commands. A true read-only role leaves out exec rights so users cannot open shells.
Built-in view roles usually block access to Secret objects by default for safety. This stops readers from pulling database keys or tokens stored in the namespace. Still, some custom roles grant read rights on all core objects by mistake. Because there are no deny rules, you cannot subtract Secrets from a wildcard rule. You must list each safe resource one by one in your role definition.
Auditor Read-Only Access + Customer Support Access to Production: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what gaps remain
Native roles and bindings do a great job of deciding who logs in. They also stop users from deleting pods or changing deployment specs through the API. For basic status checks, a namespace binding to a view role works well. It keeps the cluster state safe from bad updates during daily checks.
Still, static roles leave an operational gap during live debugging and log checks. A role only checks if a user can ask for a resource type. It cannot inspect the actual data inside a pod log or config map. Production logs and config files often contain customer emails, phone numbers, or card numbers. When a developer reads those logs, the native API sends the raw text back. Also, teams sometimes need temporary shell access to check a stuck process inside a pod. With static bindings, an admin must manually add and remove exec rights each time. If the admin forgets to remove the binding, the user keeps write access forever. Static roles also do not filter individual commands once a shell session starts.
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 sits inline as an open-source proxy, a sidecar for your Kubernetes API, without replacing RBAC. On every production call from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails refuse banned methods, paths, or headers before they run or hold risky deletes for review. 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 I add a deny rule to block one namespace in a ClusterRoleBinding?
No, permissions in this role system are purely additive and have no deny rules. To restrict someone to specific namespaces, use separate RoleBindings in each allowed namespace instead.
How do I let a user read pod logs without giving full pod control?
Grant read verbs on the pods resource and the pods log subresource in your role. Do not include the pods exec subresource, which lets users run commands inside containers.
Can I reuse one read-only ClusterRole for many different teams?
Yes, you can define one ClusterRole with your safe read rules once. Then create a separate RoleBinding in each team namespace that points to that shared ClusterRole.
Related guides
In this post