k3s-cluster/kubernetes/main/apps/monitoring/network_policy.yaml

25 lines
546 B
YAML
Raw Permalink Normal View History

2023-04-15 05:19:04 +00:00
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-most-allow-some
namespace: monitoring
spec:
# Apply to all pods in this namespace
podSelector: {}
ingress:
- from:
# Allow all pods in this namespace
- namespaceSelector:
matchLabels:
name: "monitoring"
# - podSelector: {}
# Allow traefik pods
- namespaceSelector:
matchLabels:
name: "traefik"
# Allow all pods with this label
- podSelector:
matchLabels:
needsMonitoring: "yes"