1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-13 19:28:55 +00:00
This commit is contained in:
Jim Bugwadia 2020-02-19 18:50:03 -08:00
parent b538838104
commit 2c95e56482
4 changed files with 26 additions and 11 deletions

View file

@ -129,7 +129,7 @@ Refer to a list of curated of ***[sample policies](/samples/README.md)*** that c
* [Background Processing](documentation/writing-policies-background.md)
* [Testing Policies](documentation/testing-policies.md)
* [Policy Violations](documentation/policy-violations.md)
* [Kyverno CLI](documentation/cli-usage.md)
* [Kyverno CLI](documentation/kyverno-cli.md)
* [Sample Policies](/samples/README.md)
## License

View file

@ -1,30 +1,32 @@
<small>*[documentation](/README.md#documentation) / kyverno-cli*</small>
# [kyverno CLI](https://github.com/nirmata/kyverno/releases) - kubectl plugin to deal with kyverno policies
# Kyverno CLI
The Kyverno Command Line Interface (CLI) is designed to validate policies and test the behavior of applying policies to resources before adding the policy to a cluster. It can be used as a kubectl plugin and as a standalone CLI.
##Installation
You can get the installation package of the cli for your os in the releases page [here](https://github.com/nirmata/kyverno/releases).
## Installation
You can download the CLI binary for your OS from the releases page [here](https://github.com/nirmata/kyverno/releases).
## Commands
#### Version
Prints the version of kyverno used by the CLI.
Example:
```
kubectl kyverno version
kyverno version
```
#### Validate
Validates a policy, can validate multiple policy resource description files or even an entire folder containing policy resource description
files. Currently supports files with resource description in yaml.
Example:
```
kubectl kyverno validate /path/to/policy1.yaml /path/to/policy2.yaml /path/to/folderFullOfPolicies
kyverno validate /path/to/policy1.yaml /path/to/policy2.yaml /path/to/folderFullOfPolicies
```
#### Apply
@ -34,13 +36,18 @@ Also supports applying the given policies to an entire cluster. The current kube
Apply to a resource:
```
kubectl kyverno apply /path/to/policy.yaml --resource /path/to/resource.yaml
kyverno apply /path/to/policy.yaml --resource /path/to/resource.yaml
```
Apply to all matching resources in a cluster:
```
kubectl kyverno apply /path/to/policy.yaml --cluster > policy-results.txt
kyverno apply /path/to/policy.yaml --cluster > policy-results.txt
```
Valid command with further complexity:
Apply multiple policies to multiple resources:
```
kubectl kyverno apply /path/to/policy1.yaml /path/to/folderFullOfPolicies --resource /path/to/resource1.yaml --resource /path/to/resource2.yaml --cluster
kyverno apply /path/to/policy1.yaml /path/to/folderFullOfPolicies --resource /path/to/resource1.yaml --resource /path/to/resource2.yaml --cluster
```
<small>*Read Next >> [Sample Policies](/samples/README.md)*</small>

View file

@ -26,3 +26,6 @@ docker validation-example2-gzfdf validation-example2 Deployment com
# Cluster Policy Violations
Cluster Policy Violations are like Policy Violations but created for cluster-wide resources.
<small>*Read Next >> [Kyverno CLI](/documentation/kyverno-cli.md)*</small>

View file

@ -22,4 +22,9 @@ Then compare the original resource definition in CM.yaml with the actual one:
kubectl get -f 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](kyverno-cli.md)
<small>*Read Next >> [Policy Violations](/documentation/policy-violations.md)*</small>