1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 09:26:54 +00:00
kyverno/samples/best_practices/require_default_network_policy.yaml

25 lines
882 B
YAML
Raw Normal View History

apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
name: default-deny-ingress-networkpolicy
2019-10-11 18:57:16 -07:00
annotations:
policies.kyverno.io/category: NetworkPolicy
2019-10-14 13:58:47 -07:00
policies.kyverno.io/description: |
By default, Kubernetes allows all ingress and egress traffic to and from pods within a cluster. A "default" NetworkPolicy resource for a namespace should be used to deny all ingress traffic to the pods in that namespace. Additional NetworkPolicy resources can then be configured to allow desired traffic to application pods.
spec:
rules:
- name: "default-deny-ingress"
match:
resources:
kinds:
- Namespace
2019-10-09 23:46:18 -07:00
name: "*"
generate:
kind: NetworkPolicy
name: default-deny-ingress
data:
spec:
# select all pods in the namespace
podSelector: {}
policyTypes:
2019-10-14 10:47:54 -07:00
- Ingress