fix: use CiliumNetworkPolicy for kube-apiserver egress
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: cilium.io/v2
|
||||||
|
kind: CiliumNetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: allow-kube-api
|
||||||
|
namespace: api
|
||||||
|
spec:
|
||||||
|
endpointSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: api-gateway
|
||||||
|
egress:
|
||||||
|
- toEntities:
|
||||||
|
- kube-apiserver
|
||||||
@@ -9,6 +9,7 @@ resources:
|
|||||||
- service.yaml
|
- service.yaml
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- network-policy.yaml
|
- network-policy.yaml
|
||||||
|
- cilium-netpol.yaml
|
||||||
- configmap.yaml
|
- configmap.yaml
|
||||||
|
|
||||||
# The deployed image tag lives here and nowhere else. CI publishes
|
# The deployed image tag lives here and nowhere else. CI publishes
|
||||||
|
|||||||
+3
-14
@@ -30,20 +30,9 @@ spec:
|
|||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 8080
|
port: 8080
|
||||||
egress:
|
egress:
|
||||||
# Allow Kubernetes API server (ServiceAdapter CRD loader)
|
# Kubernetes API server egress is handled by CiliumNetworkPolicy
|
||||||
# ClusterIP VIP (10.96.0.1:443) + real control-plane endpoints (port 6443)
|
# (k8s/cilium-netpol.yaml) using toEntities: kube-apiserver.
|
||||||
- to:
|
# Standard NetworkPolicy ipBlock doesn't work with Cilium for service VIPs.
|
||||||
- ipBlock:
|
|
||||||
cidr: 10.96.0.1/32
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 443
|
|
||||||
- to:
|
|
||||||
- ipBlock:
|
|
||||||
cidr: 192.168.1.0/24
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 6443
|
|
||||||
# Allow DNS
|
# Allow DNS
|
||||||
- to:
|
- to:
|
||||||
- namespaceSelector:
|
- namespaceSelector:
|
||||||
|
|||||||
Reference in New Issue
Block a user