How to Configure OpenShift Admission Controller
You set up an openshift admission controller by registering validating or mutating webhooks on the API server. These webhooks check or change API requests after role checks pass and before etcd saves the object. Platform teams use these rules to block bad pod settings and enforce cluster standards. Still, broad role bindings still let users run commands inside pods after admission checks finish. When teams grant wide permissions to fix issues fast, admission rules cannot control interactive sess
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 admission controller by registering validating or mutating webhooks on the API server. These webhooks check or change API requests after role checks pass and before etcd saves the object. Platform teams use these rules to block bad pod settings and enforce cluster standards. Still, broad role bindings still let users run commands inside pods after admission checks finish. When teams grant wide permissions to fix issues fast, admission rules cannot control interactive sessions.
How an openshift admission controller works in the API flow
Every request to the cluster goes through three steps before the database saves it. First, the API server checks who the user is. Second, role-based access control checks if the user has permission for that action. In this step, a Role sets permissions inside one namespace. A ClusterRole sets permissions across the whole cluster. A RoleBinding or ClusterRoleBinding links those rules to a user or group. All rules in this system are additive, so there are no deny rules.
Third, the openshift admission controller runs its checks on the request. Built-in plugins and external webhooks inspect the object payload before the cluster creates or updates it. Mutating controllers run first and can edit the request to add default labels or limits. Validating controllers run next and give a simple yes or no answer. If any validating check says no, the API server stops the request right away. The user gets an error message, and the cluster state stays safe.
Setting up webhook rules and scoping cluster roles
To add a custom webhook, you first deploy a small service that reads admission review requests. This service must use TLS certificates so the API server trusts the connection. Next, you register the webhook object at the cluster level. You define which API groups, versions, and verbs should trigger the webhook check. Most teams focus on create, update, and delete actions for workloads and roles.
You also set a failure policy for the webhook. This setting tells the API server what to do if your webhook service goes down. You can tell the server to reject all matching requests or let them pass through. You must also scope who can edit the webhook objects themselves. Since webhook definitions apply across the whole cluster, only admins with a tight ClusterRoleBinding should manage them. Regular developers should hold a namespace Role that only covers their own app workloads.
K8s Admission Controllers + OpenShift RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native admission checks solve and what they miss
Admission webhooks are great at checking static YAML files before a pod starts. They stop teams from running privileged containers or pulling untrusted images. They can also check requests to subresources like pod logs or pod exec endpoints. In RBAC, these subresources use a slash format to represent the API path. An admission webhook can see that a user asked to open an exec session on a pod.
Still, the admission check ends the moment the API server approves that request. The controller only sees the initial request to open the stream. It cannot see the shell commands an engineer types inside the running container after the session starts. It also cannot mask sensitive data like emails, phone numbers, card numbers, or national IDs in output streams. Once a user enters a pod or queries a database, admission rules are out of the loop. Teams need controls that inspect individual commands and rewrite sensitive fields in results during live sessions.
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 is the difference between mutating and validating admission controllers?
Mutating controllers can change the object in the API request before the cluster saves it. Validating controllers only inspect the final object and either allow or block the request.
Do admission controllers replace Kubernetes RBAC roles?
No, RBAC runs first to check if a user can perform an action on a resource. Admission controllers run after RBAC to inspect the content of the allowed request.
Can an openshift admission controller block commands inside an active pod shell?
No, it can only allow or block the initial request to start the exec session. It cannot inspect or stop specific shell commands once the stream is open.
Related guides
In this post