How do you validate manifests before they reach the cluster (policy as code)?
Short answer
Gate merges in CI with schema validation (kubeconform), policy engines (OPA/Gatekeeper, Kyverno, Conftest), and dry-runs. Admission controllers on the cluster enforce policy at apply time too. This shifts errors left so only compliant, valid manifests are merged and reconciled.
Advertisement
AModel answer
Gate merges in CI with schema validation (kubeconform), policy engines (OPA/Gatekeeper, Kyverno, Conftest), and dry-runs. Admission controllers on the cluster enforce policy at apply time too. This shifts errors left so only compliant, valid manifests are merged and reconciled.
Real-world example
A CI step runs Conftest policies so a manifest missing resource limits fails the PR before it can be synced.
Likely follow-ups
- What is policy as code? | Where do admission controllers fit?
Related topics