How to Configure Ose Kube RBAC Proxy

Published
Length
3 min read

Luis Felipe Dias

All posts

The ose kube rbac proxy guards pod ports by checking Kubernetes role rules first. You set it up as a sidecar container that filters incoming traffic before your app sees it. Many cluster apps expose metric ports or debug endpoints without built-in login checks. Adding this sidecar lets your team reuse cluster role rules to protect those local ports. It stops unauthorized pods or users from reading internal app stats. How ose kube rbac proxy works in a pod In OpenShift, ose kube rbac proxy ru

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.

The ose kube rbac proxy guards pod ports by checking Kubernetes role rules first. You set it up as a sidecar container that filters incoming traffic before your app sees it.

Many cluster apps expose metric ports or debug endpoints without built-in login checks. Adding this sidecar lets your team reuse cluster role rules to protect those local ports. It stops unauthorized pods or users from reading internal app stats.

How ose kube rbac proxy works in a pod

In OpenShift, ose kube rbac proxy runs inside the same pod as your main app. Your main app listens only on the local loopback network inside the pod. The sidecar container listens on the public pod network interface instead.

When a scraper or user sends a request, the sidecar catches it first. It reads the bearer token from the request header and asks the cluster API to check it. First, the cluster API checks if the token belongs to a real user or service account.

Next, the sidecar asks the cluster API if that caller has permission to read the path. If the caller passes both checks, the sidecar forwards the traffic to your main app. If either check fails, the sidecar drops the request and returns an error code.

This pattern affects both cluster monitoring tools and human engineers who query pod endpoints. To keep the setup safe, bind your main app strictly to the local pod address. Otherwise, callers can bypass the sidecar and hit the app port on the pod IP.

How to set up roles and safe defaults

Setting up the sidecar requires a dedicated service account for the pod itself. That service account needs permission to create token reviews and subject access reviews in the cluster. Without those two permissions, the sidecar cannot ask the control plane to check incoming tokens.

Database Proxy (ProxySQL, PgBouncer) + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You also give the sidecar a rule file that maps web paths to cluster permissions. Safe defaults block all traffic unless a caller holds an explicit role for that resource. Teams should set up TLS certificates on the sidecar port so tokens never cross the network in plain text.

OpenShift can mount serving certificates into the pod through a service annotation. You should also set strict resource limits on the sidecar so heavy traffic cannot starve your main app. Always scope caller roles to specific namespaces rather than granting cluster-wide read rights.

Checking logs and limits of static role rules

To check your setup, send a test request with a low-privilege service account token. The sidecar should block the call and log the denied attempt in its container output. Next, send a request using the monitoring service account token to confirm valid reads work.

You should check both the sidecar container logs and the central cluster audit logs. Sidecar logs show connection errors, while cluster audit logs record the permission checks from the API server. Still, static cluster role rules have real limits when engineers need live access to pods or data stores.

Once a role grants access, the permission stays active until an admin removes the binding. Static role checks only verify who starts the session, not what commands or queries run inside it. They also cannot rewrite sensitive fields like emails, phone numbers, card numbers, or national IDs in returned results.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What is the difference between upstream kube-rbac-proxy and ose kube rbac proxy?

The OpenShift version is the Red Hat build of the upstream Kubernetes sidecar image. It ships with OpenShift clusters to guard operator metrics and system pod endpoints.

Why do pods still fail to connect after adding the sidecar?

Most failures happen when the pod service account lacks permission to run token reviews. Check that the pod service account holds the system auth delegator cluster role.

Can the sidecar protect ports for non-HTTP traffic?

No, it mainly inspects HTTP and HTTPS requests that carry bearer tokens or client certificates. It does not parse native database wire protocols or inspect raw queries inside a session.

The query runs. The emails stay hidden.