- Authors

- Name
- Youngju Kim
- @fjvbn20031
- 1. Architecture Comparison
- 2. Policy Language
- 3. Feature Comparison
- 4. Performance
- 5. Selection Guide
- 6. Summary
1. Architecture Comparison
Kyverno: Kubernetes-native, 3 controllers (Admission, Background, Reports), single CRD (ClusterPolicy), supports validate/mutate/generate/verifyImages.
OPA/Gatekeeper: General-purpose OPA + Kubernetes adapter, ConstraintTemplate + Constraint two-layer model, validation-focused with alpha mutation support.
2. Policy Language
Kyverno: YAML + CEL
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-labels
spec:
rules:
- name: check-app-label
match:
any:
- resources:
kinds: ['Deployment']
validate:
pattern:
metadata:
labels:
app.kubernetes.io/name: '?*'
OPA/Gatekeeper: Rego
apiVersion: templates.gatekeeper.sh/v1
kind: ConstraintTemplate
metadata:
name: k8srequiredlabels
spec:
targets:
- target: admission.k8s.gatekeeper.sh
rego: |
package k8srequiredlabels
violation[{"msg": msg}] {
provided := {l | input.review.object.metadata.labels[l]}
required := {l | l := input.parameters.labels[_]}
missing := required - provided
count(missing) > 0
msg := sprintf("Missing labels: %v", [missing])
}
| Aspect | Kyverno | OPA/Gatekeeper |
|---|---|---|
| Language | YAML + CEL | Rego |
| Learning curve | Low | High |
| Expressiveness | Medium (CEL supplements) | High (Turing-complete) |
3. Feature Comparison
| Feature | Kyverno | OPA/Gatekeeper |
|---|---|---|
| Validation | Native | Native |
| Mutation | Full support | Alpha (v3.10+) |
| Generation | Native | Not supported |
| Image verification | Native | External tools needed |
| CEL support | Yes | v3.16+ |
4. Performance
| Policies | Kyverno latency | OPA/Gatekeeper latency |
|---|---|---|
| 10 | ~5ms | ~3ms |
| 50 | ~15ms | ~8ms |
| 100 | ~30ms | ~15ms |
OPA/Gatekeeper compiles Rego policies for faster evaluation. Kyverno has YAML parsing overhead.
5. Selection Guide
Choose Kyverno when: Kubernetes-only, YAML-familiar team, need mutation/generation/image verification, minimize learning curve.
Choose OPA/Gatekeeper when: Use OPA outside Kubernetes, need complex policy logic, performance-critical at scale, team already knows Rego.
6. Summary
| Aspect | Kyverno | OPA/Gatekeeper |
|---|---|---|
| Accessibility | High (YAML) | Medium (Rego) |
| Feature scope | Wide (4 rule types) | Narrow (validation focus) |
| Performance | Good | Excellent |
| Image verification | Native | External tools |
| CNCF maturity | Incubating | Graduated |
Both tools are production-proven. Choose based on team capabilities and requirements.