diff --git a/admin/talos.md b/admin/talos.md index 4910a1d..91821d0 100644 --- a/admin/talos.md +++ b/admin/talos.md @@ -140,13 +140,82 @@ talosctl kubeconfig --nodes 192.168.10.11 ~/.kube/config kubectl get nodes ``` -### 7. Déployer Flannel (CNI) +### 7. Flannel (CNI) — intégré à Talos +Talos v1.13 inclut Flannel nativement dans `kube-system` avec le bon CIDR `10.42.0.0/16`. + +**Ne pas appliquer** le manifest Flannel externe — ça crée un conflit de deux DaemonSets qui mettent les pods en CrashLoopBackOff. + +Si vous avez appliqué le manifest externe par erreur : ```bash -kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml +kubectl delete namespace kube-flannel +# Corriger la ClusterRoleBinding pour pointer vers kube-system +kubectl patch clusterrolebinding flannel --type='json' \ + -p='[{"op": "replace", "path": "/subjects/0/namespace", "value": "kube-system"}]' +kubectl delete pod -n kube-system -l app=flannel ``` -Les nœuds passent `NotReady` → `Ready` en ~1 minute. +Les nœuds passent `NotReady` → `Ready` en ~1 minute après le bootstrap. + +### 8. Installer MetalLB + +```bash +helm repo add metallb https://metallb.github.io/metallb +helm repo update +kubectl create namespace metallb-system +helm install metallb metallb/metallb --namespace metallb-system +# Attendre que les pods soient Running +kubectl get pods -n metallb-system -w +``` + +Configurer le pool d'IPs : +```bash +cat <<'EOF' | kubectl apply -f - +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: funk-pool + namespace: metallb-system +spec: + addresses: + - 192.168.10.200-192.168.10.230 +--- +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: funk-l2 + namespace: metallb-system +spec: + ipAddressPools: + - funk-pool +EOF +``` + +### 9. Installer Traefik + +```bash +helm repo add traefik https://traefik.github.io/charts +helm repo update +kubectl create namespace infra +helm install traefik traefik/traefik \ + --namespace infra \ + --set service.type=LoadBalancer \ + --set service.loadBalancerIP=192.168.10.200 \ + --set ports.web.port=80 \ + --set ports.websecure.port=443 \ + --set ingressRoute.dashboard.enabled=true \ + --set logs.general.level=INFO +``` + +Vérifier que l'IP `192.168.10.200` est assignée : +```bash +kubectl get svc -n infra traefik +``` + +### 10. DNS wildcard *.lab.local + +Le rôle dnsmasq Ansible configure automatiquement `address=/.lab.local/192.168.10.200`. +Après `ansible-playbook --tags dnsmasq`, tout nom `.lab.local` résout vers Traefik. --- @@ -237,3 +306,6 @@ export KUBECONFIG=~/.kube/config | etcd backup | Critique sur single control-plane — planifier en cron | | RAM workers | 8 GB sur compute-02/03 — toujours définir `resources.requests/limits` | | VIP | Ne pas configurer de VIP = même IP que le nœud — inutile et cassant | +| Flannel externe | Ne PAS appliquer le manifest Flannel officiel — Talos l'inclut nativement | +| ClusterRoleBinding flannel | Doit pointer vers `kube-system`, pas `kube-flannel` | +| MetalLB webhook | Nécessite que Flannel soit 100% healthy avant d'appliquer IPAddressPool | diff --git a/ansible/roles/dnsmasq/defaults/main.yml b/ansible/roles/dnsmasq/defaults/main.yml index bc3a55c..3479045 100644 --- a/ansible/roles/dnsmasq/defaults/main.yml +++ b/ansible/roles/dnsmasq/defaults/main.yml @@ -18,6 +18,8 @@ dhcp_static_hosts: name: compute-03 ip: 192.168.10.13 +traefik_ip: 192.168.10.200 + dns_cluster_hosts: - name: storage-01 ip: 192.168.10.1 diff --git a/ansible/roles/dnsmasq/templates/dnsmasq.conf.j2 b/ansible/roles/dnsmasq/templates/dnsmasq.conf.j2 index 19dcbb0..5c059f6 100644 --- a/ansible/roles/dnsmasq/templates/dnsmasq.conf.j2 +++ b/ansible/roles/dnsmasq/templates/dnsmasq.conf.j2 @@ -23,6 +23,9 @@ address=/{{ host.name }}.{{ dns_domain }}/{{ host.ip }} address=/{{ host.name }}/{{ host.ip }} {% endfor %} +# Wildcard *.lab.local → IP MetalLB Traefik (ingress) +address=/.{{ dns_domain }}/{{ traefik_ip }} + # DHCP — plage dynamique pour le LAN cluster dhcp-range={{ dhcp_range_start }},{{ dhcp_range_end }},{{ dhcp_lease_time }} dhcp-option=option:dns-server,{{ lan_ip }}