Created
November 25, 2025 06:36
-
-
Save nyrahul/133c77902edf5a8b04591199cac1d51a to your computer and use it in GitHub Desktop.
Install Kyverno and Auto delete netpol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install Kyverno | |
| kubectl create namespace kyverno | |
| kubectl apply -f https://raw.githubusercontent.com/kyverno/kyverno/main/config/release/install.yaml | |
| kubectl apply -f - <<'EOF' | |
| apiVersion: kyverno.io/v1 | |
| kind: ClusterPolicy | |
| metadata: | |
| name: block-auto-networkpolicy | |
| spec: | |
| validationFailureAction: Enforce | |
| rules: | |
| - name: block-auto-created-np | |
| match: | |
| any: | |
| - resources: | |
| kinds: | |
| - NetworkPolicy | |
| namespaces: | |
| - radiusai | |
| validate: | |
| message: "Auto-created NetworkPolicy is not allowed." | |
| pattern: | |
| metadata: | |
| name: "egress" | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment