# Kyverno policies for AI agents

DevFeed: [Kyverno policies for AI agents](<https://devfeed.tech/articles/kyverno-policies-for-ai-agents-119465.md>)

Original publisher: [Read original article](<https://nirmata.com/2026/11/04/kyverno-policies-for-ai-agents/>)

Author: Ritesh Patel

Published: 2026-11-04T15:00:00Z

Content type: tutorial

Language: en

Sources: [Nirmata](<https://devfeed.tech/sources/nirmata.md>)

Topics: [Kyverno](<https://devfeed.tech/topics/kyverno.md>), [policy-as-code](<https://devfeed.tech/topics/policy-as-code.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [admission](<https://devfeed.tech/tags/admission.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agents](<https://devfeed.tech/tags/ai-agents.md>), [cli](<https://devfeed.tech/tags/cli.md>), [kubernetes-security](<https://devfeed.tech/tags/kubernetes-security.md>), [kyverno](<https://devfeed.tech/tags/kyverno.md>), [pod](<https://devfeed.tech/tags/pod.md>), [pod-security](<https://devfeed.tech/tags/pod-security.md>), [pods](<https://devfeed.tech/tags/pods.md>), [policies](<https://devfeed.tech/tags/policies.md>), [policy](<https://devfeed.tech/tags/policy.md>), [policy-as-code](<https://devfeed.tech/tags/policy-as-code.md>), [security](<https://devfeed.tech/tags/security.md>), [test](<https://devfeed.tech/tags/test.md>)

## AI overview

Kyverno can reject unsafe AI agent pod specs at Kubernetes admission with a `ValidatingPolicy`, while background evaluation reports violations in pods already running. The sample targets labeled agent pods and checks privilege escalation, non-root execution, Linux capabilities, and `hostPath` volumes. Its coverage is limited: it checks `containers` only, so add `initContainers` and `ephemeralContainers`, and it does not check seccomp or `runAsUser`. The article recommends starting with `Audit`, reviewing PolicyReports and fixing workloads or adding narrow exceptions, then switching to `Deny`. Test failing and compliant manifests with `kyverno apply` in CI, and use admission enforcement in the cluster. The excerpt says `ClusterPolicy` is deprecated from Kyverno v1.19 and recommends `ValidatingPolicy` for new rules. Admission controls apply to pod specs, not actions by processes already running inside an allowed pod.

## Source excerpt

Kyverno policies for AI agents: enforce Pod Security Restricted controls on agent pods at admission with a ValidatingPolicy, then test the policy with the CLI.