Skip to main content

Kyverno Policy Catalog

Purpose: For security officers, provides all 17 ClusterPolicies with name, enforcement mode, and customization instructions.

Repository

These Kyverno ClusterPolicies are maintained in the openCenter-gitops-base repository at applications/base/services/kyverno/default-ruleset/. The openCenter-cli generates FluxCD manifests that reference these policies — it does not define or manage the policies themselves. To inspect, customize, or audit policy definitions, work directly with openCenter-gitops-base.

Overview

openCenter deploys 17 Kyverno ClusterPolicies from openCenter-gitops-base/applications/base/services/kyverno/default-ruleset/. These policies are deployed via FluxCD and apply cluster-wide. They complement Pod Security Admission by providing finer-grained validation, mutation, and audit reporting.

Policy Catalog

Container Security

#PolicyModeDescription
1disallow-privileged-containersenforceRejects pods with securityContext.privileged: true
2disallow-privilege-escalationenforceRejects pods with allowPrivilegeEscalation: true
3require-run-as-nonrootenforceRequires runAsNonRoot: true on all containers
4disallow-capabilitiesenforceDrops all capabilities; allows only a defined safe list
5restrict-seccompenforceRequires RuntimeDefault or Localhost seccomp profile

Host Isolation

#PolicyModeDescription
6disallow-host-namespacesenforceBlocks hostPID, hostIPC, and hostNetwork
7disallow-host-pathenforceBlocks hostPath volume mounts
8disallow-host-portsenforceBlocks hostPort bindings on containers

Volume and Storage

#PolicyModeDescription
9restrict-volume-typesenforceAllows only configMap, emptyDir, projected, secret, downwardAPI, persistentVolumeClaim, csi
10disallow-default-namespaceauditWarns when resources are created in the default namespace

Image and Registry

#PolicyModeDescription
11require-image-tagenforceRejects images using :latest or no tag
12restrict-image-registriesauditWarns on images from non-approved registries

Resource Management

#PolicyModeDescription
13require-resource-limitsauditWarns when pods lack CPU/memory limits
14require-resource-requestsauditWarns when pods lack CPU/memory requests

Workload Best Practices

#PolicyModeDescription
15require-probesauditWarns when deployments lack readiness/liveness probes
16require-labelsauditWarns when resources lack standard labels (app.kubernetes.io/name, etc.)
17restrict-sysctlsenforceBlocks unsafe sysctl settings

Enforcement Modes

  • enforce — the policy rejects non-compliant resources at admission time. The resource is not created.
  • audit — the policy allows the resource but records a violation in the Kyverno PolicyReport. Visible in kubectl get policyreport -A.

Customization

Changing a Policy Mode

Override the policy in the customer overlay. For example, to change require-resource-limits from audit to enforce:

# applications/overlays/<cluster>/services/kyverno/patches/require-resource-limits.yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-resource-limits
spec:
validationFailureAction: Enforce

Excluding Namespaces

Add namespace exclusions to a policy:

spec:
rules:
- name: require-limits
exclude:
any:
- resources:
namespaces:
- kube-system
- monitoring

Viewing Policy Reports

# List all policy violations across namespaces
kubectl get policyreport -A

# Detailed report for a namespace
kubectl get policyreport -n <namespace> -o yaml

Further Reading