Openshift Restricted-v2

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openshift restricted v2 policy to force pods to run with strict security rules. This built-in profile stops containers from running as the root user and drops risky Linux rights. Teams rely on this policy to lock down workloads across shared clusters. They pair pod security rules with Kubernetes role bindings to control who can manage those pods. Yet broad user roles still let staff open shells inside running containers and read sensitive files. How openshift restricted v2 and R

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 restricted v2 policy to force pods to run with strict security rules. This built-in profile stops containers from running as the root user and drops risky Linux rights.

Teams rely on this policy to lock down workloads across shared clusters. They pair pod security rules with Kubernetes role bindings to control who can manage those pods. Yet broad user roles still let staff open shells inside running containers and read sensitive files.

How openshift restricted v2 and RBAC work together

Container security starts with two distinct layers. The pod security profile controls what a container can do on the host node. Meanwhile, Kubernetes Role-Based Access Control decides what human users and service accounts can do through the API.

In Kubernetes, a Role or ClusterRole holds a list of rules that grant permissions. These rules are purely additive, which means there are no deny rules in the system. A Role sets permissions inside one namespace, while a ClusterRole can cover the whole cluster.

Admins connect these rules to users with a RoleBinding or a ClusterRoleBinding. A RoleBinding grants access in a single namespace and can point to a Role or ClusterRole. A ClusterRoleBinding grants permissions across all namespaces at once.

When a team deploys an app, the security profile checks the pod spec before it starts. The pod must run as a non-root user and drop extra kernel permissions. Once the pod is running, RBAC rules govern who can view or change it.

Where native pod and role rules fall short

Native pod rules do a great job of protecting the host node from a broken container. Even if an attacker compromises the app, the container cannot easily take over the underlying server. Still, pod rules do not govern what an engineer does inside an active terminal session.

OpenShift RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

During an outage, developers often need to check a live pod to fix a bug. In Kubernetes RBAC, API subresources like pod logs and pod exec use a slash in their names. Admins grant permissions to the pods exec subresource so engineers can open a shell.

Once Kubernetes approves that exec request, the API server steps out of the way. RBAC decides who can start the shell, but it cannot see the commands typed inside. An engineer with exec rights can read local files, inspect env vars, or query connected databases.

Also, Kubernetes RBAC does not let you restrict create requests on subresources by specific resource names. If a role allows exec in a namespace, the user can enter any pod in that namespace. Teams end up handing out broad namespace access just to let staff debug a single service.

Closing the gap for live container sessions

To keep production data safe, teams must look beyond static pod specs and basic role bindings. You need a way to govern what happens after an engineer connects to a cluster resource. Instead of granting standing exec rights across a whole namespace, you should check every command in flight.

Fine-grained controls let you approve a single debug action without opening the whole namespace. You can also mask sensitive values like emails, phone numbers, card numbers, and national IDs in outputs. When masking rewrites matched fields in results, staff can fix issues while private data stays safe.

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 main goal of the openshift restricted v2 profile?

It forces pods to run with least privilege on the host node. Containers must run as non-root users and cannot gain extra kernel rights.

Does openshift restricted v2 block users from running pod exec commands?

No, the pod security profile only checks how the container runs on the node. Kubernetes RBAC rules control which users can run exec commands against a pod.

Can Kubernetes RBAC add a deny rule to block specific pod commands?

No, Kubernetes RBAC permissions are purely additive and do not support deny rules. Once a user has exec access, native RBAC cannot filter individual shell commands.

The query runs. The emails stay hidden.