mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-08 06:24:42 +02:00
feat: MetalLB + Traefik + wildcard DNS lab.local
- MetalLB pool 192.168.10.200-230 (L2 mode) - Traefik LoadBalancer sur 192.168.10.200 (HTTP/HTTPS) - dnsmasq wildcard *.lab.local → 192.168.10.200 - Fix Flannel CrashLoopBackOff : ClusterRoleBinding corrigée (kube-flannel → kube-system) - Doc talos.md : procédure complète MetalLB + Traefik + pièges Flannel Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bb72145365
commit
c8a1faa632
3 changed files with 80 additions and 3 deletions
|
|
@ -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 `<service>.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 |
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue