Open Policy Agent (OPA) is an open source policy engine that evaluates rules against data, requests, and configurations. Teams use OPA to make consistent decisions about authorization, security, compliance, and operational controls across applications, Kubernetes, CI/CD pipelines, and cloud infrastructure.
OPA separates policy decisions from application or platform code. Instead of hard-coding rules into each service, you write policies in one place and ask OPA whether a request, deployment, or configuration should be allowed.
OPA can answer questions such as:
OPA receives structured input, usually JSON, and evaluates it against policies written in Rego, OPA’s policy language. It then returns a decision, such as allow, deny, or a more detailed response with reasons and metadata.
A typical OPA flow looks like this:
OPA can run as a sidecar, a host-level daemon, a library, or part of another tool. For Kubernetes admission control, many teams use Gatekeeper OPA to enforce policies before resources are created or changed in a cluster.
A platform team wants to prevent Kubernetes workloads from running as privileged containers. They write a Rego policy that checks incoming pod specs. When a developer submits a deployment, the Kubernetes admission controller sends the resource to OPA. If the pod sets privileged: true, OPA returns a deny decision and the deployment is rejected before it reaches the cluster.
OPA helps teams standardize policy decisions across many systems. It can reduce duplicated authorization logic, make policy reviews easier, and give security teams a consistent way to define controls.
There are tradeoffs. Rego has a learning curve, and policy design needs careful testing. If policies are too broad, they can block valid work. If they are too loose, they may miss important risks. OPA also returns decisions rather than enforcing every action by itself, so the integrating system must apply the result correctly.
OPA is a general-purpose policy engine. It can support many environments, including apps, Kubernetes, CI/CD, and infrastructure workflows. By comparison, Azure Policy focuses on governing Azure resources, such as requiring tags, restricting regions, or auditing resource settings inside Azure subscriptions.
OPA also differs from an identity provider. An identity provider authenticates who someone is. OPA decides whether that identity, combined with context and policy, should be allowed to take a specific action.