Check pods with Kyverno
The kyverno add-on checks every pod against the Pod Security Standards, reporting first and refusing when you choose.
Replace my-cluster with your cluster's name or id.
The kyverno add-on runs Kyverno with the Kubernetes Pod Security Standards as policies:
level |
Policies | What it stops |
|---|---|---|
baseline (default) |
12 | Privileged containers, host namespaces, host paths and ports, added capabilities, unsafe sysctls |
restricted |
18 | Also: running as root, privilege escalation, missing seccomp, volume types beyond the safe ones |
In audit mode (the default) a pod that breaks a policy still runs and the violation is written to
a PolicyReport in its namespace. In enforce mode the pod is refused. Start in audit, read the
reports, fix or exclude, then enforce.
Kubernetes' own namespaces, kyverno, and the namespaces of Deutsche Cloud add-ons that need
privileged pods (opentelemetry-collector, velero) are never checked; excludeNamespaces adds
your own.
Install and read the reports
- Open Kubernetes, open the cluster, then choose Add-ons.
- Choose Add an add-on, then Policies (Kyverno).
- Choose the standard and whether a violation is reported or refused.
- Choose Install.
dcloud eks addons create my-cluster --name kyverno --config 'level="baseline"' --config 'mode="audit"'POST /eks/api/clusters/my-cluster/addons
{ "name": "kyverno", "config": { "level": "baseline", "mode": "audit" } }resource "dcloud_eks_addon" "kyverno" {
cluster_id = dcloud_eks_cluster.main.id
name = "kyverno"
config = jsonencode({ level = "baseline", mode = "audit" })
}kubectl get policyreports -ATo enforce, change mode to enforce (Change on the add-on's row). You need
eks:UpdateAddon.