Kyverno CLI
$ kyverno Foundation Low RiskThe kyverno CLI evaluates Kyverno policies against local YAML manifests or live clusters without installing the in-cluster admission controller. It supports --output-format json on kyverno apply and -o json on kyverno test, plus --explain rule tracing.
brew install kyverno kyverno apply and kyverno test validate local policy directories offline with -o json and --explain far faster than any MCP round-trip.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Outputs structured JSON via --output-format json (apply) and -o json (test), plus --explain and --fail-only for terse agent feedback.
kyverno apply --policy-report --output-format jsonkyverno test -o json --fail-onlyand--explain
Purely read-only policy evaluation by default (never mutates the live cluster even when --cluster is used); can optionally write mutated YAML only if -o file path is specified.
- Read-only evaluation; never mutates live cluster resources
Single static Go binary available via Homebrew, Krew, and GitHub Releases across macOS, Linux, and Windows.
- Cross-platform binary via
brew install kyverno
Catches Kubernetes policy and CEL violations locally in CI or pre-commit before manifests reach the cluster.
- Offline policy and CEL validation
CNCF incubating project (kyverno/kyverno) maintained under Apache-2.0.
- Official CNCF
kyverno/kyvernorepository
Clear kyverno.io/docs/kyverno-cli/ documentation and examples.
- Official Kyverno CLI documentation
Security, Auth & Guardrails
Requires no credentials for local manifest/test validation; uses ~/.kube/config (KUBECONFIG) only when --cluster is passed.
CLI is free (Apache-2.0) and runs locally without API billing.
# Kyverno CLI Agent Rules - Keep evaluations local by default (`kyverno apply -r <file>`); only pass `--cluster` for intentional live audits. - Use `--policy-report --output-format json` (for `apply`) or `-o json` (for `test`) for structured parsing. - Use `--explain` when debugging why a policy rule matched or skipped.
Agent-Ready Command Recipes
Safe Read-Only Queries
kyverno apply policy.yaml --resource deploy.yaml --policy-report --output-format json
Applies Kyverno policies locally in read-only mode and outputs a structured JSON policy report.
kyverno test ./policies -o json --fail-only
Executes kyverno-test.yaml suites locally and emits failing assertions in JSON.
Strengths for Agents
- + Offline, read-only policy validation with structured JSON output on both
applyandtest. - +
--explaintraces rule matching and variable evaluation cleanly for debugging. - + Zero cluster mutations even when auditing live resources with
--cluster.
Caveats & Pitfalls
- ! Flag names differ slightly between subcommands (
--output-format jsononapplyvs-o jsonontest). - ! Mutating policies require
--outputto inspect transformed manifests.