mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
23 lines
725 B
YAML
23 lines
725 B
YAML
apiVersion: kyverno.io/v1alpha1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: disallow-node-port
|
|
annotations:
|
|
policies.kyverno.io/category: Security
|
|
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.
|
|
spec:
|
|
rules:
|
|
- name: disallow-node-port
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Service
|
|
validate:
|
|
message: "Disallow service of type NodePort"
|
|
pattern:
|
|
spec:
|
|
type: "!NodePort"
|
|
|