How to Configure OpenShift Exec Into Pod
To run an openshift exec into pod command, you need pod exec permissions. A cluster admin grants this access through role-based access control rules. Most teams start by giving developers broad roles across a whole namespace. That approach helps people fix bugs fast, but it opens big security risks. When a role is too wide, anyone can run commands inside live containers. How openshift exec into pod permissions work OpenShift uses the core Kubernetes role system to control who runs container c
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 run an openshift exec into pod command, you need pod exec permissions. A cluster admin grants this access through role-based access control rules. Most teams start by giving developers broad roles across a whole namespace. That approach helps people fix bugs fast, but it opens big security risks. When a role is too wide, anyone can run commands inside live containers.
How openshift exec into pod permissions work
OpenShift uses the core Kubernetes role system to control who runs container commands. Every rule in this system is additive, so there are no deny rules. You start with zero access and add rules through a Role or ClusterRole. A Role sets permissions inside one single namespace for your team. A ClusterRole sets permissions across the whole cluster and covers all namespaces.
To let a user run commands, the role must include the pod exec subresource. In the API server, subresources use a slash after the main resource name. The rule must list both the main pods resource and the exec subresource. Without that specific subresource rule, the API server blocks the command request. You can also restrict a subresource rule to specific pod names.
After you define the Role or ClusterRole, you must attach it to users. A RoleBinding links a role to a user or group inside one namespace. You can even use a RoleBinding to apply a ClusterRole to one namespace. A ClusterRoleBinding grants those permissions across every namespace in the entire cluster. For pod exec access, teams should prefer a namespace RoleBinding over cluster-wide bindings.
How to scope roles for container command access
Good role design starts by splitting read rules from active command rules. Most developers only need to read pod status and view container logs. Log viewing uses a separate log subresource, so you can grant it alone. You should put pod exec permissions in a separate role for incident response. That way, daily work happens without open shell access to live containers.
When you create the exec role, keep it locked to a single namespace. Avoid using a ClusterRoleBinding for human users who debug apps. If a developer only owns one service, restrict the role to that namespace. You can also bind the role to a small on-call group. When the incident ends, you can remove the user from that group.
K8s Pod Security Standards + OpenShift RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they leave open
Native roles and bindings do a good job of guarding the front door. The API server checks who is logging in and blocks unauthorized users. It also makes sure a developer in one namespace cannot touch another team's pods. This setup stops random users from opening shells across your cluster.
Still, native role checks stop once the shell or command starts running. The role only decides if the user may enter the container. It does not check which specific commands the user runs inside that session. Once inside, a user can read local files or check container memory. They can also query internal network services or pull sensitive data from disk. Native permissions cannot rewrite sensitive fields like emails or card numbers in output. The API server also does not ask for peer approval per command.
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
What permission allows a user to run commands in a pod?
A user needs a Role or ClusterRole that includes the pods exec subresource. That role must then link to the user through a RoleBinding or ClusterRoleBinding.
Can I allow pod logs without allowing pod exec?
Yes, pod logs and pod exec are two different subresources in the API. You can grant the log subresource in a role while leaving out exec.
Should I use a RoleBinding or a ClusterRoleBinding for pod exec?
Use a RoleBinding whenever possible so the access stays inside one single namespace. A ClusterRoleBinding gives exec access across every namespace, which is risky for live apps.
Related guides
In this post