2019-10-10 18:42:54 -07:00
|
|
|
apiVersion: "kyverno.io/v1alpha1"
|
|
|
|
kind: "ClusterPolicy"
|
|
|
|
metadata:
|
|
|
|
name: "deny-use-of-host-fs"
|
2019-10-11 18:57:16 -07:00
|
|
|
annotations:
|
|
|
|
policies.kyverno.io/category: Data Protection
|
2019-10-14 16:33:19 -07:00
|
|
|
policies.kyverno.io/description: The volume of type 'hostpath' binds pods to a specific host,
|
|
|
|
and data persisted in the volume is dependent on the life of the node. In a shared cluster,
|
|
|
|
it is recommeded that applications are independent of hosts.
|
2019-10-10 18:42:54 -07:00
|
|
|
spec:
|
|
|
|
rules:
|
|
|
|
- name: "deny-use-of-host-fs"
|
|
|
|
match:
|
|
|
|
resources:
|
|
|
|
kinds:
|
|
|
|
- "Pod"
|
|
|
|
validate:
|
|
|
|
message: "Host path is not allowed"
|
|
|
|
pattern:
|
|
|
|
spec:
|
|
|
|
volumes:
|
|
|
|
- X(hostPath): null
|