Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 1015 Bytes

testing-policies.md

File metadata and controls

30 lines (18 loc) · 1015 Bytes

documentation / Testing Policies

Testing Policies

The resources definitions for testing are located in the test directory. Each test contains a pair of files: one is the resource definition, and the second is the Kyverno policy for this definition.

Test using kubectl

To do this you should install Kyverno to the cluster.

For example, to test the simplest Kyverno policy for ConfigMap, create the policy and then the resource itself via kubectl:

cd test
kubectl create -f policy/policy-CM.yaml
kubectl create -f resources/CM.yaml

Then compare the original resource definition in CM.yaml with the actual one:

kubectl get -f resources/CM.yaml -o yaml

Test using Kyverno CLI

The Kyverno CLI allows testing policies before they are applied to a cluster. It is documented at Kyverno CLI

Read Next >> Policy Violations