Optimizing Kubernetes admission control: Where Kyverno’s CEL admission cost actually goes
3 similar posts
- Kyverno
- Kubernetes
AI Summary
An investigation into Kyverno's CEL-based admission control engine revealed that 86% of allocated memory went into repeatedly parsing the admitted object for each matched policy rather than evaluating policies. Moving the object conversion outside the per-policy loop reduced allocations and execution time significantly, changing scaling behavior from O(policies) to O(1) per request.
Key Takeaways
- Profiling revealed ConvertObjectToUnstructured accounted for 86.8% of allocated bytes before the fix.
- The root cause was parsing the same incoming JSON object once per matched policy inside a loop.
- The fix converts the object once per request before policy evaluation and reuses the result safely.
Why it matters
Understanding hidden performance bottlenecks in Kubernetes admission controllers helps engineers design more scalable clusters. By avoiding redundant object serialization, teams can run dozens of security policies without scaling penalties.
Conversation0
What would you add from your experience?
Checking your session…
Every good conversation starts with one perspective.