1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 09:56:55 +00:00
kyverno/samples/additional/policy_validate_sysctl_configs.yaml
2019-10-09 10:39:25 -07:00

23 lines
849 B
YAML

apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
name: validate-allow-portrange-with-sysctl
spec:
validationFailureAction: "audit"
rules:
- name: allow-portrange-with-sysctl
match:
resources:
kinds:
- Pod
validate:
message: "Allowed port range is from 1024 to 65535"
pattern:
spec:
securityContext:
sysctls:
- name: net.ipv4.ip_local_port_range
value: "1024 65535"
# Configure and use kernel parameters within a POd cluster using namespaced sysctl
# (refer to https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/ for the list of supported namespaced sysctl interfaces)
# The minimum and maximum port a network connection can use as its source(local) port can be validating by checking net.ipv4.ip_local_port_range