From 0d163bef84e08fb9360968fd4e71939b5cbda00f Mon Sep 17 00:00:00 2001 From: Adrien Bouvais Date: Sun, 16 Aug 2026 15:18:40 +0200 Subject: [PATCH] Added network policy --- charts/tenant/templates/networkpolicy.yaml | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 charts/tenant/templates/networkpolicy.yaml diff --git a/charts/tenant/templates/networkpolicy.yaml b/charts/tenant/templates/networkpolicy.yaml new file mode 100644 index 0000000..2c762c0 --- /dev/null +++ b/charts/tenant/templates/networkpolicy.yaml @@ -0,0 +1,44 @@ +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: jupyter-netpol + namespace: {{ .Release.Namespace }} + labels: + app: jupyter + tenant: 'tenant-{{ .Values.name }}' +spec: + podSelector: + matchLabels: + app: jupyter + tenant: 'tenant-{{ .Values.name }}' + policyTypes: + - Ingress + - Egress + + # Entrée : Autorise le trafic vers le Notebook Jupyter sur le port 8888 + ingress: + - ports: + - protocol: TCP + port: 8888 + + # Sortie : Restreint les communications aux composants strictement nécessaires + egress: + # 1. Résolution DNS dans kube-system + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: kube-system + ports: + - protocol: UDP + port: 53 + - protocol: TCP + port: 53 + + # 2. Flux vers l'API MinIO (Stockage S3) + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: minio + ports: + - protocol: TCP + port: 9000