Kyverno is a Kubernetes-native policy management tool that simplifies the management of complex Kubernetes configurations through declarative policies. It allows for validation, mutation, and generation of configurations while supporting all Kubernetes resource types. The tool is designed for ease of use, making it accessible for users to adopt and implement best practices in Kubernetes environments.
Introduction to Kyverno as a Kubernetes native policy management tool. Overview of presentation structure including topics like use cases and roadmap.
Kyverno is a policy engine for Kubernetes using native resources. Importance of policies in managing complex configurations in Kubernetes and the role of admission controllers.
Key advantages of using Kyverno: declarative policies, easy validation, mutation functions, support for all resource types, and alignment with Kubernetes best practices.
Comparison of Kyverno and OPA through a practical example. Outlining components of Kyverno policies, including kinds, names, selector options, and user roles.
How Kyverno operates: Mutate, Validate, and Generate features explained through methods such as JSON Patch and conditionals. Triggers and patterns for desired state matching.
Discussion of policy reports and advanced features of Kyverno like external lookups, deny rules, and automated generation for CI/CD.
Examples of Kyverno application: security validation, RBAC, multi-tenancy, auto-labeling, and sidecar injection.
Introduction to Pod Security Policies (PSP) and Kyverno's alignment with new pod security levels being developed.
Roadmap for Kyverno highlighting major upcoming features and community contribution avenues through GitHub and Slack.
Summary of the key takeaways regarding the usefulness of policies in Kubernetes, ease of use of Kyverno, and an invitation for users to install and provide feedback.
2
Kyverno - KubernetesNative Policy Management
• Why Kyverno
• How it works
• Use Cases
• Roadmap
• Q&A
3.
3
What is Kyverno?
•A policy engine designed for Kubernetes
• Uses Kubernetes resources, patterns, idioms
• Familiar to Kubernetes users
4.
4
Why Policies?
• Kubernetesconfigurations are complex to manage
across developers and operations.
• External configuration tools (Helm, Kustomize) etc.
cannot ensure environment specific configurations.
• Admission controllers provide a way to validate best
practices and mutate configurations.
• Policy management tools like Kyverno use admission
control and provide a way to manage “policies” and
“rules” without creating custom controllers.
5.
Why Kyverno?
1. Declarativepolicies that are easy to write and manage
2. Policy results that are easy to view and process
3. Validate (audit or enforce), Mutate, and Generate
4. Support all Kubernetes resource types including CRs
5. Adopt Kubernetes patterns and practices e.g. labels and
selectors, annotations, events, ownerReferences, pod controllers, etc.
5
10
Mutate
● JSON Patch(RFC 6902)
○ Use for precise updates
● StrategicMergePatch
○ Use for describing intent
○ Anchors for conditional logic
• “If-then-else”
• “if-not-defined”
11.
11
Validate
● Overlays withpatterns specify
desired state
● Matches all defined fields
● Patterns
○ * : zero or more
○ ? : any one
● Operators
○ >, <, >=, <=, !, |(or)
12.
12
Generate
● Triggers whena new
resource is created
● Useful in creating defaults
for a namespace
● Clones existing resources or
copies in-line data
● Can optionally keep data in-
sync across namespaces
14
Advanced Features
• Anchorsand operators
• Variables
– Inline policy data
– JMESPath
• External data lookups
– Config Maps
– API Calls
• Deny rules
• Auto-generation of pod controller rules
• Command Line for CI/CD and dev-test for policies
15.
15
Use Cases
• Securityvalidation and enforcement
• Fine-grained RBAC
• Multi-tenancy
• Auto-Labeling
• Sidecar (including certificate) injection with mounts, etc.
• IFTTT for Kubernetes
17
Pod Security
• Whatis a Pod Security Policy (PSP)?
o Cluster resource that controls security configuration of pods
o Being marked for deprecation in v1.21 removal in v1.25
• A KEP is being developed to replace PSP with namespace
based Pod Security Levels
Privileged Baseline Restricted
18.
18
Kyverno Policies forPod Security
• Also based on Pod Security Levels
• Available at: https://kyverno.io/policies/pod-security/
23
Summary and Takeaways
1.Policies are useful in managing Kubernetes configurations
at scale
2. Kyverno is built for Kubernetes
3. Kyverno can validate (audit or enforce), mutate, and
generate configurations
4. Kyverno supports best practices for pod security and
isolation
5. Kyverno is easy to use! Install Kyverno in your clusters, try
the best practice policies, and give us feedback!