Cloud Computing (AWS Focus)

Kyverno Performance Optimization: Solving the Admission Control Bottleneck in Kubernetes

Kyverno’s evolution toward a Common Expression Language (CEL)-based engine has marked a significant shift in how Kubernetes clusters manage policy enforcement. However, recent performance profiling conducted by the engineering team at Nirmata has revealed that the engine’s efficiency was being throttled not by the complexity of the policies themselves, but by redundant object processing. This discovery, detailed in findings released in November 2026, has led to a critical optimization in Kyverno version 1.19.2 that drastically reduces CPU and memory overhead during the admission control process.

The Anatomy of an Admission Control Bottleneck

In the architecture of a Kubernetes cluster, the admission control process is a high-stakes gatekeeper. Every time an object—such as a Pod, Deployment, or Service—is created or modified, the Kubernetes API server sends an AdmissionRequest to various controllers, including Kyverno. The engine must then evaluate this request against a set of policies to decide whether to allow, reject, or mutate the resource.

Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes

For years, the industry standard for these policies was the legacy JMESPath engine. As Kubernetes matured, the community pivoted toward CEL, a more robust, Google-developed language designed for high-performance expression evaluation. While the migration to CEL was intended to improve speed, developers began noticing that in high-load scenarios, the engine failed to match expected benchmarks compared to alternative solutions.

When engineers profiled the admission path, the initial hypothesis was that the CEL evaluation logic itself was computationally expensive. The profiling data, however, told a different story. Analysis revealed that approximately 86% of the memory allocated during the admission process was spent on "preparing the object for evaluation," specifically converting raw JSON bytes into a structured map format that CEL could parse. Only a negligible fraction of resources was being utilized for the actual policy enforcement logic.

Chronology of the Optimization Effort

The realization that Kyverno was inefficiently handling input data triggered a comprehensive review of the engine’s execution loop. The problem stemmed from the engine’s design: it was parsing the incoming AdmissionRequest object once for every single policy being evaluated.

Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes

In a typical production environment, a cluster might enforce multiple security standards simultaneously—such as the Pod Security Standards, which often involve around 16 distinct policies. Under the previous architecture, if a Pod creation triggered 16 policies, Kyverno would parse the same Pod JSON data into a map 16 separate times. This resulted in an O(n) complexity, where the performance cost grew linearly with the number of deployed policies.

The timeline of the fix was as follows:

  • Early 2026: Performance benchmarks highlight discrepancies between Kyverno and other policy engines, sparking internal investigations into the CEL engine’s efficiency.
  • Mid-2026: Profiling tools identify the conversion of API objects to CEL-ready maps as the primary consumer of heap memory and CPU cycles.
  • Late 2026: The engineering team develops a "convert-once" strategy, ensuring that the object is parsed only once per request, regardless of how many policies are subsequently triggered.
  • November 18, 2026: Kyverno 1.19.2 is released, incorporating the performance patch and legacy engine refinements.

Data-Driven Performance Gains

The impact of this architectural shift is substantial. In testing scenarios involving 64 matched policies, the number of allocations dropped from over 148,000 to approximately 8,600. The engine time required to process these requests fell from 20.01 ms to 0.36 ms.

Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes

These figures demonstrate that the per-policy "tax" has been effectively eliminated. Previously, adding a new policy to a cluster resulted in a tangible increase in latency and CPU load across the entire control plane. With the new version, the overhead of object preparation is constant, meaning that users can scale their security posture without incurring the proportional performance penalties that characterized earlier versions of the software.

Similar optimizations were applied to the image verification engine. While image verification is inherently constrained by network latency—as it must fetch signatures and attestations—the memory footprint reduction ensures that the engine remains stable even during bursts of high-volume container image deployments.

Comparative Analysis: Kyverno vs. Native Admission Policies

A central point of interest for Kubernetes operators is how Kyverno compares to the API server’s native ValidatingAdmissionPolicy. The data indicates that the "better" choice depends heavily on the scale of policy enforcement.

Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes

At a low volume (e.g., a single policy), the native API server mechanism is generally faster, as it avoids the overhead of a network hop to an external webhook. However, as the number of policies increases to a production-grade set, the native mechanism faces a bottleneck. Because the native engine dispatches each policy separately within the API server, its resource consumption grows with the number of policies.

Conversely, Kyverno’s ability to share a single, pre-converted object across all policies allows it to outperform the native solution as complexity increases. Furthermore, the CPU utilization data is striking: under heavy load, the native API server can consume upwards of 8.2 cores, with the majority of that load attributed to the policy dispatch machinery rather than the execution of the policy code itself. Kyverno’s engine, by contrast, handles this volume with roughly 3.2 cores, preserving precious control plane resources.

Legacy Engine Refinement

While the primary focus of the 1.19.2 release was the CEL engine, the team also addressed a long-standing performance regression in the legacy ClusterPolicy engine. A performance degradation between versions 1.16.4 and 1.17.0 was traced back to an overly aggressive memory-copying process implemented to ensure data isolation between rules.

Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes

The updated legacy engine now utilizes a "shallow snapshot" technique. Instead of copying the entire context for every check, it only performs a copy if a value is actually modified. This brings the performance of the legacy engine back to pre-regression levels while maintaining the necessary security guarantees. This remains a bridge for users who have not yet migrated to the modern CEL-based policies.

Broader Implications for Cluster Operations

The implications of these optimizations are twofold. First, they provide a more predictable performance profile for Kubernetes administrators. As clusters grow in size and complexity, the ability to enforce rigorous security policies without slowing down the API server is essential for maintaining operational agility.

Second, the findings emphasize the importance of rigorous profiling in the open-source ecosystem. The initial performance gap that prompted this work was not due to poor algorithmic design in the traditional sense, but rather a misunderstanding of how the engine was interacting with the data lifecycle. By challenging the assumption that the "expensive" part of the process was the policy evaluation itself, the Kyverno team was able to achieve gains that exceeded typical incremental improvements.

Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes

As Kubernetes continues to become the ubiquitous foundation for cloud-native infrastructure, the efficiency of admission controllers will remain a critical metric for platform engineers. The work done on Kyverno 1.19.2 serves as a case study for the broader community, reinforcing the need for continuous, data-backed optimization of the core components that govern cluster security.

For users looking to implement these changes, the development team has provided full documentation and testing harnesses within the Kyverno repository. By utilizing the docs/perf-testing/ directory, organizations can reproduce these benchmarks in their own environments to ensure that their specific security policies benefit from the latest efficiency improvements. Moving forward, the project roadmap includes a continued focus on concurrency and further algorithmic tuning, signaling that while this bottleneck has been cleared, the pursuit of optimal performance remains an ongoing priority for the Kyverno project.

Related Articles

Back to top button