1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 08:26:53 +00:00
kyverno/samples/more/restrict_node_port.yaml

24 lines
741 B
YAML
Raw Normal View History

2019-10-08 22:13:34 -07:00
apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
2019-11-11 14:09:07 -08:00
name: restrict-nodeport
2019-10-11 18:57:16 -07:00
annotations:
2019-11-11 18:21:16 -08:00
policies.kyverno.io/category: Workload Isolation
2019-10-14 16:33:19 -07:00
policies.kyverno.io/description: A Kubernetes service of type NodePort uses a
host port to receive traffic from any source. A 'NetworkPolicy' resource cannot be used
to control traffic to host ports. Although 'NodePort' services can be useful, their use
must be limited to services with additional upstream security checks.
2019-10-08 22:13:34 -07:00
spec:
rules:
2019-11-10 21:34:22 -08:00
- name: validate-nodeport
2019-10-08 22:13:34 -07:00
match:
resources:
kinds:
- Service
validate:
2019-11-11 14:09:07 -08:00
message: "Services of type NodePort are not allowed"
2019-10-08 22:13:34 -07:00
pattern:
spec:
type: "!NodePort"