Adding Custom Policies
This tutorial describes the steps to add custom Kyverno policies.
1. Writing a custom policy
Kyverno Policies are custom resources which are written in yaml. Checkout the official Kyverno documentation to find how to write a custom policy. The playground is really useful to validate your custom policy.
Be aware that you can find many policy examples here! Most of these are usable out of the box.
2. Deploying your custom policy
Place your custom policies in infrastructure/kyverno/policies/base/custom
. For any environment you'd like to deploy these policies, make an entry in the concerning overlay kustomization.yaml, e.g. for the Local environment: infrastructure/kyverno/policies/overlays/local/kustomization.yaml
. FluxCD will reconcile your custom policies.