Skip to content

Instantly share code, notes, and snippets.

@identw
Created January 31, 2024 22:26
Show Gist options
  • Save identw/988ffea7a0efd627da9ccb79ab46a742 to your computer and use it in GitHub Desktop.
Save identw/988ffea7a0efd627da9ccb79ab46a742 to your computer and use it in GitHub Desktop.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-host-namespaces
spec:
background: true
failurePolicy: Fail
rules:
- match:
any:
- resources:
kinds:
- Pod
name: host-namespaces
validate:
message: Sharing the host namespaces is disallowed. The fields spec.hostNetwork,
spec.hostIPC, and spec.hostPID must be unset or set to `false`.
pattern:
spec:
=(hostIPC): "false"
=(hostPID): "false"
validationFailureAction: Enforce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment