Service Configuration
medium

Pregunta de Service Configuration #019e3a4f

Enunciado de la Pregunta
Service Configuration
#open policy agent
#kubernetes
#policy-as-code
Medio

Which of the following statements is correct concerning Open Policy Agent (OPA)?

A

The policies must be written in Python language.

B

Kubernetes can use it to validate requests and apply policies.

Correcto
C

Policies can only be tested when published.

D

It cannot be used outside Kubernetes.

Explicación Oficial / Explicaciones de la Comunidad

Open Policy Agent (OPA) is a general-purpose policy engine that enables policy-as-code across the cloud-native stack. It is commonly integrated with Kubernetes via the OPA Gatekeeper or as an admission controller to validate and enforce policies on API requests.

How it Works
OPA uses a high-level declarative language called Rego to define policies. It decouples policy decision-making from the application logic, allowing policies to be updated independently. In Kubernetes, OPA can intercept admission requests and evaluate them against Rego policies before resources are persisted.

Why the correct statement is right
The statement "Kubernetes can use it to validate requests and apply policies" is correct. OPA is widely used as an admission controller in Kubernetes clusters to enforce security, compliance, and operational policies. For example, OPA Gatekeeper integrates with Kubernetes to validate resource configurations against custom policies.

Why the incorrect statements are wrong

  • "The policies must be written in Python language" is incorrect because OPA policies are written in Rego, a purpose-built declarative language, not Python.
  • "Policies can only be tested when published" is incorrect because OPA provides tools like opa test and the Rego Playground for local testing and debugging before deployment.
  • "It cannot be used outside Kubernetes" is incorrect because OPA is a general-purpose policy engine that can be used with various systems (e.g., microservices, CI/CD pipelines, SSH, SQL databases) and is not limited to Kubernetes.