Revolutionizing Kubernetes Governance with Agentic AI: Kyverno and Kagent in Action

Muskan AgrawalMuskan Agrawal
6 min read

Last night, I attended an insightful CNCF Cloud Native Live session hosted by the creators of the Kyverno project. They walked us through how Agentic AI, powered by Kyverno and Kagent, is transforming Kubernetes governance. If you’re managing Kubernetes clusters and feeling bogged down by repetitive tasks or policy sprawl, this session was a game-changer. Let’s dive into the highlights and why this matters for anyone working in the cloud-native space.

The Kubernetes Babysitting Problem

Running Kubernetes clusters in 2025 isn’t exactly a walk in the park. Mayer kicked things off by painting a relatable picture: teams are stuck “babysitting” clusters, chasing alerts, fixing repetitive issues, and rewriting the same policies over and over. With AI-generated infrastructure-as-code hitting clusters at lightning speed, human review can’t keep up. This leads to config errors, insecure defaults, and compliance gaps sneaking into production.The solution? Strong governance guardrails. But creating, explaining, and remediating policies at scale is a massive challenge. That’s where Kyverno and Agentic AI come in, offering a smarter way to manage the entire policy lifecycle.

Kyverno: The Kubernetes Policy Powerhouse

If you’re new to Kyverno, it’s a CNCF incubating project (and the most popular policy engine by GitHub stars) designed to govern Kubernetes resources. The name “Kyverno” means “to govern” in Greek, and it lives up to that promise. As a Kubernetes admission controller, it intercepts API server requests, applies rules, and ensures compliance before changes hit your cluster. Policies are written in YAML, so there’s no steep learning curve like with Rego.Kyverno’s capabilities fall into two buckets:

  • Policy Types: Validate configurations, mutate resources, generate new ones, and verify images from trusted registries.

  • Supporting Features: Clean up unused resources, run background compliance scans, and bundle policies into sets for easier management.

Teams use Kyverno for security hardening, supply chain security, multi-tenancy, and compliance with standards like PCI DSS and SOC 2. It integrates into CI/CD pipelines for shift-left security and detects policy drift post-deployment. But even with Kyverno’s power, crafting nuanced policies, explaining violations, and scaling across multi-cluster setups can still be a slog. This is where Kagent, a CNCF sandbox project, steals the show

Enter Agentic AI with Kagent

. Kagent brings Agentic AI to Kubernetes, enabling autonomous, context-aware behavior. Instead of manually writing YAML policies, you describe your intent in plain English, and Kagent generates the policy, explains violations, and even proposes fixes. It’s like having a co-pilot for Kubernetes governance.Kagent uses the Model Context Protocol (MCP) to make AI actions reproducible, reviewable, and version-controlled. It integrates with multiple LLMs (cloud-based or on-prem) and fits seamlessly into GitOps workflows. The result? You get machine-enforceable policies from human-friendly requests, closing the gap between intent and execution.

The Demo: From Intent to Action

The live demo showed how Kagent translates natural language into actionable policies. Here’s a quick rundown of what we saw:

  1. Sanity Check: When asked, “How many namespaces do I have?” Kagent queried the cluster and returned a list of eight namespaces, confirming it could talk to the cluster.

  2. Policy Creation: When requested, “Audit every pod without a team label.” Kagent generated a YAML policy, explained it in plain English, and offered alternatives (e.g., switching from audit to enforce mode). It even deployed the policy with a single command.

  3. Violation Detection: When a pod without a team label was deployed, violating the policy. Kagent’s “show violations” tool flagged the issue, explained why it failed, and suggested a fix.

  4. Complex Use Case: With a simple one-liner in english “Verify container images come from a trusted registry and are signed.” Kagent produced a detailed policy, including placeholders for public keys, and explained limitations and next steps.

  5. Help Tool: Need to understand a Kyverno feature? Kagent’s help tool pulls from Kyverno’s docs, answering questions like “What does a mutate policy do?” without digging through manuals.

The demo showed how Kagent reduces human error, shortens feedback loops, and makes governance approachable. Whether you’re a platform engineer or a developer, you can focus on intent, not YAML syntax.

Deep Dive: The Kyverno MCP Server

Under the hood of the Kyverno is MCP server, which acts as a translator between AI instructions and Kubernetes policies. The MCP server exposes five key tools:

  • Apply Policies: Tests policies against live clusters, using default sets like pod security or Kubernetes best practices.

  • Show Violations: Summarizes pre-existing violations in natural language, avoiding the need to parse massive policy reports.

  • List Context and Switch Context: Supports multi-cluster setups by listing and switching between clusters via kubeconfig.

  • Help: Provides troubleshooting and installation guidance, even in air-gapped environments.

The code behind these tools is open-source, with clear descriptions that let the AI decide when to call each tool. For example, the “apply policies” tool excludes namespaces like kube-system by default, and the “show violations” tool formats policy reports to fit within LLM context windows. In a nutshell, this is all plug-and-play, integrate it with tools like Claude, Cursor, or Amazon Q, and it works across environments.

Why This Matters

The session highlighted a critical shift: governance isn’t just about enforcement anymore; it’s about accelerating the entire policy lifecycle. Kyverno handles enforcement, while Kagent and the MCP server make policy creation, explanation, and remediation faster and more intuitive. This is especially crucial in multi-cluster setups or when AI-driven IaC moves faster than human review. For teams juggling compliance, security, and scale, this combo is a lifeline. It reduces babysitting, catches drift before it hits production, and empowers engineers to focus on building, not fixing.

Addressing Security Concerns

When using cloud-based LLMs, security is critical, especially for infrastructure data. They recommended local models for environments where data sovereignty or leaks are a worry, emphasizing best practices like avoiding sensitive data in prompts. Since Kyverno and Kagent are open-source, you can configure Kagent to use local LLMs, reducing the risk of data exposure while keeping the same governance superpowers.

Get Involved

Both Kyverno and Kagent are open-source, with vibrant communities eager for contributions. Whether you’re writing code, improving docs or experimenting with integrations like K8sGPT, there’s a place for you. Check out the resources below to dive in:

Final Thoughts

Agentic AI with Kyverno and Kagent is a glimpse into the future of Kubernetes governance. It’s not about replacing tools like Kyverno but supercharging them to keep up with the pace of modern DevOps. I walked away excited to try Kagent in my own clusters and curious about how it could integrate with tools like Prometheus for alerts or K8sGPT for observability. If you’re ready to stop babysitting your clusters, give this a spin and join the conversation in the Kyverno and Kagent communities. What’s your take on Agentic AI in Kubernetes? Drop a comment below, I’d love to hear your thoughts!

0
Subscribe to my newsletter

Read articles from Muskan Agrawal directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Muskan Agrawal
Muskan Agrawal

Cloud and DevOps professional with a passion for automation, containers, and cloud-native practices, committed to sharing lessons from the trenches while always seeking new challenges. Combining hands-on expertise with an open mind, I write to demystify the complexities of DevOps and grow alongside the tech community.