apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: wireguard namespace: wireguard spec: egress: - ports: - port: 53 protocol: UDP - port: 53 protocol: TCP to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: kube-system podSelector: matchLabels: k8s-app: kube-dns - ports: - port: 8000 protocol: TCP - port: 8443 protocol: TCP to: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: traefik podSelector: matchLabels: app.kubernetes.io/name: traefik - to: - ipBlock: cidr: 192.168.2.0/24 - ipBlock: cidr: 0.0.0.0/0 except: - 10.0.0.0/8 - 172.16.0.0/12 - 192.168.0.0/16 ingress: - from: - ipBlock: cidr: 0.0.0.0/0 ports: - port: 27299 protocol: UDP - from: - namespaceSelector: matchLabels: kubernetes.io/metadata.name: traefik ports: - port: 51821 protocol: TCP podSelector: matchLabels: app.kubernetes.io/name: wireguard policyTypes: - Ingress - Egress