apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: default-deny namespace: layshaft spec: podSelector: {} policyTypes: [Ingress, Egress] --- apiVersion: cilium.io/v2 kind: CiliumNetworkPolicy metadata: name: layshaft namespace: layshaft spec: endpointSelector: matchLabels: app.kubernetes.io/name: layshaft app.kubernetes.io/instance: layshaft ingress: - fromEntities: - host toPorts: - ports: - port: "8443" protocol: TCP - fromCIDR: - 10.115.187.218/24 - 10.140.110.30/24 - 10.186.160.23/24 - 10.63.81.107/24 - 10.162.8.60/24 toPorts: - ports: - port: "8443" protocol: TCP egress: - toEntities: - kube-apiserver toPorts: - ports: - port: "443" protocol: TCP - port: "6443" protocol: TCP - toEndpoints: - matchLabels: k8s:io.kubernetes.pod.namespace: kube-system k8s-app: kube-dns toPorts: - ports: - port: "53" protocol: UDP - port: "53" protocol: TCP - toEndpoints: - matchLabels: k8s:io.kubernetes.pod.namespace: vault app.kubernetes.io/name: vault component: server toPorts: - ports: - port: "8200" protocol: TCP - toCIDR: - 10.115.187.218/24 - 10.140.110.30/24 - 10.186.160.23/24 - 10.63.81.107/24 - 10.162.8.60/24 toPorts: - ports: - port: "8443" protocol: TCP --- apiVersion: cilium.io/v2 kind: CiliumClusterwideNetworkPolicy metadata: name: host-egress-layshaft spec: nodeSelector: {} egress: - toEndpoints: - matchLabels: k8s:io.kubernetes.pod.namespace: layshaft app.kubernetes.io/name: layshaft app.kubernetes.io/instance: layshaft toPorts: - ports: - port: "8443" protocol: TCP --- apiVersion: cilium.io/v2 kind: CiliumClusterwideNetworkPolicy metadata: name: host-ingress-layshaft-replies spec: nodeSelector: {} ingress: - fromEndpoints: - matchLabels: k8s:io.kubernetes.pod.namespace: layshaft app.kubernetes.io/name: layshaft app.kubernetes.io/instance: layshaft toPorts: - ports: - port: "32768" endPort: 60999 protocol: TCP --- apiVersion: cilium.io/v2 kind: CiliumNetworkPolicy metadata: name: layshaft namespace: vault spec: endpointSelector: matchLabels: app.kubernetes.io/name: vault component: server ingress: - fromEndpoints: - matchLabels: k8s:io.kubernetes.pod.namespace: layshaft io.cilium.k8s.policy.serviceaccount: layshaft toPorts: - ports: - port: "8200" protocol: TCP