Skip to main content
Version: 1.27.X

Kyverno

Kyverno is a policy engine designed for Kubernetes. It can validate, mutate, and generate configurations using admission controls and background scans. Kyverno policies are Kubernetes resources and do not require learning a new language. Kyverno is designed to work nicely with tools you already use like kubectl, kustomize, and Git.

Requirements

  • Kubernetes >= 1.25.0
  • Kustomize >= v3.5.3

Image repositories

  • registry.sighup.io/fury/kyverno/kyverno
  • registry.sighup.io/fury/kyverno/kyvernopre
  • registry.sighup.io/fury/kyverno/background-controller
  • registry.sighup.io/fury/kyverno/cleanup-controller
  • registry.sighup.io/fury/kyverno/reports-controller
  • registry.sighup.io/fury/bitnami/kubectl

Configuration

Kyverno is deployed in HA mode, and whitelists the KFD infra namespaces by default on the webhooks.

Pre-configured policies

This package comes with a set of predefined policies from the main kyverno repository. These policies are our own KFD baseline, and are similar to what is provided with the Gatekeeper package.

PolicyDescription
disallow-capabilities-strictAdding capabilities other than NET_BIND_SERVICE is disallowed. In addition, all containers must explicitly drop ALL capabilities.
disallow-capabilitiesAdding capabilities beyond those listed in the policy must be disallowed.
disallow-host-namespacesHost namespaces (Process ID namespace, Inter-Process Communication namespace, and network namespace) allow access to shared information and can be used to elevate privileges. Pods should not be allowed access to host namespaces. This policy ensures fields which make use of these host namespaces are unset or set to false.
disallow-host-pathHostPath volumes let Pods use host directories and volumes in containers. Using host resources can be used to access shared data or escalate privileges and should not be allowed. This policy ensures no hostPath volumes are in use.
disallow-host-portsAccess to host ports allows potential snooping of network traffic and should not be allowed, or at minimum restricted to a known list. This policy ensures the hostPort field is unset or set to 0.
disallow-latest-tagThe ':latest' tag is mutable and can lead to unexpected errors if the image changes. A best practice is to use an immutable tag that maps to a specific version of an application Pod. This policy validates that the image specifies a tag and that it is not called latest.
disallow-privilege-escalationPrivilege escalation, such as via set-user-ID or set-group-ID file mode, should not be allowed. This policy ensures the allowPrivilegeEscalation field is set to false.
disallow-privileged-containersPrivileged mode disables most security mechanisms and must not be allowed. This policy ensures Pods do not call for privileged mode.
disallow-proc-mountThe default /proc masks are set up to reduce attack surface and should be required. This policy ensures nothing but the default procMount can be specified.
require-pod-probesLiveness and readiness probes need to be configured to correctly manage a Pod's lifecycle during deployments, restarts, and upgrades.
require-run-as-nonrootContainers must be required to run as non-root users. This policy ensures runAsNonRoot is set to true. 2.
restrict-sysctlsSysctls can disable security mechanisms or affect all containers on a host, and should be disallowed except for an allowed "safe" subset.
unique-ingress-host-and-pathThis policy ensures that no Ingress can be created or updated unless it is globally unique with respect to host plus path combination.

Deployment

You can deploy kyverno by running the following command in the root of the project:

kustomize build | kubectl apply -f -