1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-01-20 18:52:16 +00:00
kyverno/samples/DisallowHostNetworkPort.md
2019-11-13 13:56:20 -08:00

731 B

Disallow hostNetwork and hostPort

Using hostPort and hostNetwork allows pods to share the host networking stack allowing potential snooping of network traffic across application pods.

Policy YAML

disallow_host_network_port.yaml

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: disallow-host-network-port
spec:
  rules:
  - name: validate-host-network-port
    match:
      resources:
        kinds:
        - Pod
    validate:
      message: "Using host networking is not allowed"
      pattern:
        spec:
          (hostNetwork): false
          containers:
          - name: "*"
            ports:
            - hostPort: null