Skip to content

Policy Engines for Platform Governance: CNPA practice questions

Policy engines let a platform turn its rules into code that is evaluated automatically: images must come from approved registries, containers must not run privileged, every Deployment needs an owner label, production namespaces need resource limits. Kyverno's introduction defines policies in cloud-native systems as configurations that manage other configurations or runtime behaviors. For platform teams this is how guardrails scale.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Policy Engines for Platform Governance covers in CNPA

Policy engines let a platform turn its rules into code that is evaluated automatically: images must come from approved registries, containers must not run privileged, every Deployment needs an owner label, production namespaces need resource limits. Kyverno's introduction defines policies in cloud-native systems as configurations that manage other configurations or runtime behaviors. For platform teams this is how guardrails scale. Instead of reviewing every manifest by hand, the platform rejects or fixes what breaks the rules and reports what already does.

The main enforcement point in Kubernetes is admission control, which runs in two phases: mutating admission controllers first, then validating ones. Policy engines plug in as dynamic admission webhooks. For simpler rules Kubernetes also offers ValidatingAdmissionPolicy, stable since v1.30, a declarative, in-process alternative to validating webhooks that evaluates Common Expression Language (CEL) expressions inside the API server.

Open Policy Agent (OPA), a graduated CNCF project, is a general-purpose policy engine that decouples policy decisions from enforcement. Software sends OPA structured input such as JSON, OPA evaluates it against policies written in its declarative language, Rego, together with data, and returns a decision, which can be richer than allow or deny. It is used for Kubernetes, microservices, CI/CD pipelines and API gateways. OPA Gatekeeper brings OPA to Kubernetes as a validating and mutating webhook: a ConstraintTemplate defines a reusable, parameterized policy and a Constraint instantiates it, with validation able to deny, warn, dry-run, audit or report. Gatekeeper's audit shows existing resources that violate a policy, which matters because admission only sees new or changed requests.

Kyverno takes a Kubernetes-native approach. Policies are Kubernetes resources written in YAML and CEL, so there is no new language to learn, and they can validate, mutate, generate or clean up resources and verify container images and their metadata for supply chain security. Kyverno runs as a dynamic admission controller, its CLI applies the same policies to manifests and other files in a pipeline, and for resources that were allowed or existed before a policy it creates Policy Reports with their results. It also supports explicit policy exceptions.

Governance works best in layers. The same policies run as early checks in CI, at admission as the hard gate, and as continuous audit of what is already running. A sensible rollout introduces a rule in a warn or audit mode, fixes existing violations, then enforces it, and handles special cases through exceptions rather than by disabling the policy.

Misconceptions: policy engines are not only for security, since they also cover cost, reliability and naming conventions; admission policies do not fix existing resources on their own; and RBAC is not a substitute, because RBAC decides who may make a request while a policy decides whether the content of that request is acceptable.

At associate level, expect to choose between OPA/Gatekeeper and Kyverno for a requirement, to place a check in CI, admission or audit, and to describe what mutating and validating admission each do.

Key points

  • Admission runs mutating controllers first, then validating ones.
  • OPA evaluates JSON input against Rego policies; Gatekeeper uses ConstraintTemplate and Constraint resources.
  • Kyverno policies are Kubernetes resources in YAML and CEL and can validate, mutate, generate and clean up.
  • ValidatingAdmissionPolicy evaluates CEL in the API server without a webhook.
  • Audit and policy reports cover resources that existed before a policy was introduced.

Three sample questions

8 CNPA questions on Policy Engines for Platform Governance, 8 with explanations. How practice works

Question 1

How does Open Policy Agent (OPA) separate concerns between your software and policy?
  1. A.It decouples decision-making from enforcement: software sends input and enforces OPA's decision.
  2. B.It works only as a Kubernetes admission controller, so it cannot be queried by any other kind of software.
  3. C.Its policies must be written in YAML so that they can be stored as Kubernetes resources.
  4. D.It enforces policy itself by finding and killing non-compliant processes on each host.

Correct answer: A

The OPA documentation explains that OPA decouples policy decision-making from policy enforcement: when software needs a decision it queries OPA with structured data such as JSON, OPA evaluates it against policies written in Rego and data, and the software enforces the result. Why the other options are wrong. "It works only as a Kubernetes admission controller, so ...": OPA is a general-purpose engine used across the stack; Gatekeeper is the Kubernetes admission integration. "Its policies must be written in YAML so that ...": OPA policies are written in Rego. "It enforces policy itself by finding and killing non-compliant ...": OPA returns decisions; enforcement stays with the software that queried it.

Sources: CNCF CNPA curriculum (CNPA_Curriculum.pdf), Open Policy Agent documentation

Question 2

A platform team uses OPA Gatekeeper. Besides blocking requests at admission, which capability lets administrators see existing resources that already violate a policy?
  1. A.kubectl diff
  2. B.Gatekeeper's audit functionality
  3. C.ConstraintTemplate mutation
  4. D.Pod Security Admission warn mode

Correct answer: B

The Gatekeeper documentation describes it as a validating and mutating webhook enforcing CRD-based policies executed by OPA, and adds that, in addition to admission, its audit functionality lets administrators see what resources are currently violating any given policy. Why the other options are wrong. "kubectl diff": kubectl diff previews changes from local files; it does not evaluate policies. "ConstraintTemplate mutation": ConstraintTemplates define reusable validation policy logic; mutation uses separate mutator resources and does not report violations. "Pod Security Admission warn mode": That is a built-in Kubernetes admission feature for Pod Security Standards, not part of Gatekeeper.

Sources: CNCF CNPA curriculum (CNPA_Curriculum.pdf), OPA Gatekeeper documentation

Question 3

A platform team wants policies written as Kubernetes resources in YAML (or CEL) without a new policy language, and also wants to generate resources such as a default NetworkPolicy in every new namespace. Which project's documentation matches this?
  1. A.Open Policy Agent with Rego
  2. B.Pod Security Admission
  3. C.Falco
  4. D.Kyverno

Correct answer: D

Kyverno's introduction describes it as a cloud native policy engine where you use YAML and CEL to author policies with no new language to learn, and that can validate, mutate, generate or clean up Kubernetes resources. Why the other options are wrong. "Open Policy Agent with Rego": OPA policies are written in Rego, a dedicated policy language. "Pod Security Admission": Pod Security Admission only enforces the Pod Security Standards levels; it cannot generate resources. "Falco": Falco is runtime security: it detects abnormal behaviour from kernel events; it does not generate Kubernetes resources.

Sources: CNCF CNPA curriculum (CNPA_Curriculum.pdf), Kyverno: Introduction

Practice this topic

Focus mode keeps every question on Policy Engines for Platform Governance until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CNPA practice across all topics.

Sources

The explanation above was checked against these official documents.