How to Configure OpenShift Service Account
You set up an openshift service account by creating the account in a namespace. Next, you bind that account to a specific role with clear permission rules. Platform teams often start by granting broad cluster roles to get apps running fast. Broad roles let one compromised pod read secrets or change workloads across the whole cluster. A safe setup scopes each account to the exact actions one workload needs. How an openshift service account works with roles Every pod in your cluster needs a way
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 an openshift service account by creating the account in a namespace. Next, you bind that account to a specific role with clear permission rules. Platform teams often start by granting broad cluster roles to get apps running fast. Broad roles let one compromised pod read secrets or change workloads across the whole cluster. A safe setup scopes each account to the exact actions one workload needs.
How an openshift service account works with roles
Every pod in your cluster needs a way to talk to the API server. An openshift service account gives a pod or automated tool a distinct identity. By itself, a new account has almost no permissions to read or change resources. You must pair the account with role-based access control rules to grant permissions.
In the underlying Kubernetes system, a Role or ClusterRole holds a set of permission rules. These permissions are purely additive, which means there are no deny rules at all. A standard Role always sets permissions within one single namespace. A ClusterRole is not namespaced and can cover cluster-wide resources such as nodes. It can also cover non-resource endpoints or namespaced resources across all namespaces.
After you define a role, you link it to your account with a binding. A RoleBinding grants permissions inside one specific namespace. That binding can reference a local Role or a shared ClusterRole. If you use a ClusterRoleBinding instead, you grant permissions across the entire cluster. For most apps, you should use a RoleBinding inside the workload namespace.
Scoping subresources and pod actions
When you write rules for an openshift service account, you name the target resources. RBAC refers to resources by the same name that appears in the API URL. Some API calls involve a subresource, such as reading a pod log or running commands. In RBAC rules, you write the subresource with a slash, like pods and log.
You should separate basic pod viewing from subresources that run commands inside containers. If an account only needs to check pod status, do not grant exec subresource rules. Keeping subresource rules tight stops automated tools from running shell commands in production pods. You should also give each app its own dedicated account instead of sharing the default one. When each app has a separate identity, you can revoke or rotate permissions without breaking neighbors.
Service-to-Service Authentication + Service Account Governance: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they miss
Native roles and bindings do a great job of controlling which API endpoints an identity can reach. They stop a pod in one namespace from deleting resources in another namespace. They also let platform teams audit which accounts hold permissions to read cluster secrets.
Still, native role bindings only check permissions when the API call starts. Once a person or script gets permission to open an interactive pod shell, RBAC steps back. The cluster does not inspect the individual commands run inside that open shell session. It also cannot mask sensitive fields like emails, phone numbers, card numbers, or national IDs in output. Teams that need command-level checks or data masking must look beyond static role bindings.
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 an openshift service account role?
No, native RBAC permissions are purely additive and do not support deny rules. To block an action, you must remove the rule or binding that grants that permission.
Should I use a RoleBinding or a ClusterRoleBinding for an app?
Use a RoleBinding for almost all app workloads so permissions stay inside one namespace. You can bind a reusable ClusterRole through a RoleBinding to keep permissions scoped locally.
How do I let an account read pod logs without full pod control?
Grant read permissions specifically on the pods log subresource in your role definition. Do not include the exec subresource or write verbs on the base pod resource.
Related guides
In this post