92 lines
2.5 KiB
YAML
92 lines
2.5 KiB
YAML
# Isolation réseau du namespace monitoring (beszel-agent) — deny-by-default +
|
|
# allowlist :
|
|
# - Egress : HTTPS sortant vers le Hub sur son port dédié agents (10002,
|
|
# pas 8090/dashboard — voir beszel-agent-secret.yml et
|
|
# ansible-mln/monitoring/security/nginx/nginx.conf) pour
|
|
# l'auto-enregistrement au démarrage.
|
|
# - Ingress : le Hub se connecte à l'agent en SSH sur le port LISTEN
|
|
# (10002) pour récupérer les métriques — IP du Hub non fixe/connue
|
|
# d'avance, ouvert largement mais authentifié par TOKEN/KEY (voir
|
|
# beszel-agent-secret.yml), pas par l'origine réseau.
|
|
#
|
|
# ⚠️ LIMITE IMPORTANTE : le DaemonSet tourne en hostNetwork: true (voir
|
|
# daemonset-beszel.yml) — avec Calico (CNI de ce cluster, voir
|
|
# deploy/cni/calico-install.yml), un NetworkPolicy standard ne s'applique en
|
|
# général PAS aux pods hostNetwork (il faudrait un HostEndpoint/
|
|
# GlobalNetworkPolicy Calico, une ressource différente, pour un enforcement
|
|
# réel au niveau du nœud). Ce manifeste reste appliqué pour la correction
|
|
# d'intention et si hostNetwork est retiré un jour, mais ne pas compter
|
|
# dessus comme protection effective du port 10002 en l'état — un pare-feu
|
|
# hôte (iptables/nftables/ufw) ou une GlobalNetworkPolicy Calico est
|
|
# nécessaire pour une vraie restriction.
|
|
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: default-deny-all
|
|
namespace: monitoring
|
|
spec:
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Ingress
|
|
- Egress
|
|
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-ingress-hub-ssh
|
|
namespace: monitoring
|
|
spec:
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
- from: []
|
|
ports:
|
|
- protocol: TCP
|
|
port: 10002
|
|
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-egress-dns
|
|
namespace: monitoring
|
|
spec:
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Egress
|
|
egress:
|
|
- to:
|
|
- namespaceSelector:
|
|
matchLabels:
|
|
kubernetes.io/metadata.name: kube-system
|
|
ports:
|
|
- protocol: UDP
|
|
port: 53
|
|
- protocol: TCP
|
|
port: 53
|
|
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-egress-hub-https
|
|
namespace: monitoring
|
|
spec:
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Egress
|
|
egress:
|
|
- to:
|
|
- ipBlock:
|
|
cidr: 0.0.0.0/0
|
|
except:
|
|
- 10.0.0.0/8
|
|
- 172.16.0.0/12
|
|
- 192.168.0.0/16
|
|
ports:
|
|
- protocol: TCP
|
|
port: 10002
|