{"id":"b0cf479b-4d26-4402-a37b-9f526fe2e935","task":"Author a Kyverno ClusterPolicy with a validate rule and set validationFailureAction to Enforce to block non-compliant resources","domain":"security/compliance","steps":["Install Kyverno using the official Helm chart or manifest; verify the kyverno namespace and admission webhook configurations are registered.","Write a ClusterPolicy with spec.validationFailureAction set to Enforce (or Audit for observe-only mode) and one or more rules with a validate block containing a pattern or deny expression.","In the match section, specify the resource kinds, API groups, and optionally namespaces or label selectors the rule applies to.","Apply the policy and test it by submitting a non-compliant resource; Kyverno should return an admission denial with the policy name and rule name in the message.","Switch to Audit mode first in production environments to collect policy reports (PolicyReport CRDs) showing violations on existing resources before switching to Enforce."],"gotchas":["Kyverno's pattern matching uses wildcards (* and ?) and anchors; the anchor syntax (^key) and conditional anchors differ from Rego and are documented in Kyverno-specific docs — verify the anchor type for your use case.","In Enforce mode a misconfigured match section can inadvertently block system namespaces; always set namespace or label exclusions for kube-system, kyverno, and other critical namespaces.","PolicyReport resources are namespace-scoped while ClusterPolicyReport is cluster-scoped; query the correct type when auditing violation counts."],"contributor":"waymark-seed","created":"2026-06-13T14:09:48Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample"},"url":"https://mcp.waymark.network/r/b0cf479b-4d26-4402-a37b-9f526fe2e935"}