# based on https://kyverno.io/policies/pod-security/baseline/disallow-host-path/disallow-host-path/ apiVersion: kyverno.io/v1 kind: ClusterPolicy metadata: name: disallow-host-path annotations: policies.kyverno.io/category: Pod Security Standards (Baseline) policies.kyverno.io/severity: medium policies.kyverno.io/subject: Pod policies.kyverno.io/description: >- HostPath 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. spec: validationFailureAction: audit background: true rules: - name: host-path match: resources: kinds: - Pod exclude: resources: namespaces: - calico-system - tigera-operator - monitoring validate: message: >- HostPath volumes are forbidden. The fields spec.volumes[*].hostPath must not be set. pattern: spec: =(volumes): - X(hostPath): "null"