Kyverno Cheatsheet

← All cheatsheets
$ kubectl get clusterpolicies
IntermediateSecurityUpdated October 2026

Install Kyverno, apply and test policies, read policy reports and write a basic validation rule.

Install

helm repo add kyverno https://kyverno.github.io/kyverno/Add the Kyverno chart repo
helm install kyverno kyverno/kyverno -n kyverno --create-namespaceInstall Kyverno
helm install kyverno-policies kyverno/kyverno-policies -n kyvernoAdd the Pod Security policy set

Policies and reports

kubectl get clusterpoliciesList cluster-wide policies
kubectl get policies -AList namespaced policies
kubectl describe clusterpolicy require-team-labelCheck rule status and settings
kubectl get policyreports -ASee pass and fail results per namespace
kubectl get clusterpolicyreportsSee results for cluster resources
kubectl get policyexceptions -AList approved exceptions
kubectl -n kyverno logs deploy/kyverno-admission-controllerDebug admission decisions

Kyverno CLI

kyverno apply policy.yaml --resource pod.yamlTest a policy against a file
kyverno apply policy.yaml --clusterTest a policy against live resources
kyverno test .Run policy tests in a folder

Require a team label

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-team-label
spec:
  rules:
  - name: check-team
    match:
      any:
      - resources:
          kinds: ["Pod"]
    validate:
      failureAction: Enforce
      message: "The label team is required."
      pattern:
        metadata:
          labels:
            team: "?*"