OpsCanary
kubernetessecurityPractitioner

Kyverno and CEL: Optimizing Admission Control in Kubernetes

5 min read CNCF BlogNov 18, 2026Reviewed for accuracy
Share
Practitioner — Hands-on experience recommended

Kubernetes admission control is crucial for enforcing policies and ensuring security in your cluster. However, it can become a performance bottleneck, particularly when multiple policies are evaluated for each admission request. Kyverno, a policy engine for Kubernetes, leverages Common Expression Language (CEL) to evaluate these policies. The challenge arises from the way Kyverno processes incoming AdmissionRequests, which can lead to redundant computations and increased latency.

When Kyverno receives an AdmissionRequest, it converts the raw JSON bytes into an unstructured map that CEL can understand. This conversion was previously done within a loop that iterated over each matched policy. In a typical scenario, such as creating a Pod with the Pod Security Standards set, around 16 policies might match. This means the same Pod was parsed 16 times, leading to unnecessary overhead. The recent optimization in Kyverno 1.19.2 moves this conversion outside the loop, allowing the engine to build the CEL request value once and reuse it for each policy. This change accounted for a staggering 86.8% of the allocation costs in the previous implementation, streamlining the evaluation process significantly.

In production, this optimization can lead to noticeable improvements in admission control performance. However, be cautious about the implementation details. The first attempt at optimization used a single shared builder for all CEL engines, which inadvertently altered policy behaviors. Always test your policies thoroughly after making changes. Remember to check the limitations section before quoting any performance metrics, as real-world scenarios may vary.

Key takeaways

  • →Understand that CEL engines evaluate policies against a CEL activation, which is a set of variables your policy expressions can reference.
  • →Recognize that moving the conversion of AdmissionRequests out of the policy evaluation loop can drastically reduce overhead.
  • →Monitor the performance impact of policy evaluations, as the previous implementation led to 86.8% of allocation costs from redundant parsing.
  • →Test your policies after optimization changes to avoid unintended behavior from shared builders.
  • →Keep an eye on version updates, as significant performance improvements were introduced in Kyverno 1.19.2.

Why it matters

Optimizing admission control can lead to faster response times in your Kubernetes cluster, reducing latency during critical operations like Pod creation. This is essential for maintaining high availability and performance in production environments.

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
Linux FoundationSponsor

Industry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKA — the gold standard Kubernetes administrator cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.

Get CKA certified →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.