74 lines
4.2 KiB
Markdown
74 lines
4.2 KiB
Markdown
|
|
# Home kubeadm cluster — native routing over WireGuard
|
||
|
|
|
||
|
|
## Nodes
|
||
|
|
|
||
|
|
| Node | Role | LAN | WireGuard | Pod CIDR | Arch |
|
||
|
|
|------|------|-----|-----------|----------|------|
|
||
|
|
| rpi | traffic/worker, WG hub, cloudflared, wgportal | 192.168.1.125 | wg0 10.10.0.1 (k8s-mesh), wg-remote 10.20.0.2 | 10.244.1.0/24 | arm64 |
|
||
|
|
| siriussec (ThinkPad T480) | control-plane and worker; label gateway=true | 192.168.1.179 | wg0 10.10.0.2 | 10.244.0.0/24 | amd64 |
|
||
|
|
| linode | worker, dedicated=network PreferNoSchedule | public VPS | wg0 10.20.0.1, dummy-k8s 10.10.0.5 | 10.244.2.0/24 | amd64 |
|
||
|
|
| Legion | admin kubectl/k9s only — not a node | — | wg0 10.10.0.3 | none | amd64 |
|
||
|
|
|
||
|
|
Cluster: kubeadm v1.36.4. API https://10.10.0.2:6443 (VPN-only). nft on T480 accepts :6443 on lo, wg0, and 10.244.0.0/16; drops other :6443.
|
||
|
|
|
||
|
|
rpi taint: dedicated=network:PreferNoSchedule. Label dedicated=network. Default pods land on siriussec.
|
||
|
|
linode taint: dedicated=network:PreferNoSchedule. Label dedicated=network.
|
||
|
|
Pin traffic/light: nodeSelector {dedicated: network}.
|
||
|
|
Pin app/DB/Forgejo: nodeSelector {kubernetes.io/hostname: siriussec}.
|
||
|
|
|
||
|
|
## WireGuard hub-and-spoke
|
||
|
|
|
||
|
|
Pi is the hub.
|
||
|
|
|
||
|
|
- Interface wg0 / k8s-mesh on Pi: Address 10.10.0.1/24, ListenPort 51820.
|
||
|
|
- Pi wg0 extra_allowed_ips for peer siriussec: 10.10.0.2/32, 10.244.0.0/24.
|
||
|
|
- Pi wg0 peers legion 10.10.0.3/32, SiriusMobile 10.10.0.4/32.
|
||
|
|
- Spoke AllowedIPs (siriussec, Legion): 10.10.0.0/24, 10.244.0.0/16. Not a full tunnel.
|
||
|
|
- Linode is NOT a wg0 peer. Linode is on Pi interface wg-remote: Pi Address 10.20.0.2/24, peer AllowedIPs 10.20.0.0/24, 10.10.0.5/32, 10.244.2.0/24. Linode Address 10.20.0.1/24, ListenPort 51820, AllowedIPs include 10.20.0.2/32, 10.10.0.0/24, 10.96.0.0/12, 10.244.0.0/16.
|
||
|
|
- wgportal: official image wgportal/wg-portal:v2, host network on Pi, UI http://192.168.1.125:8888, manages wg0 only.
|
||
|
|
|
||
|
|
ip_forward=1 on Pi, siriussec, linode.
|
||
|
|
|
||
|
|
## Cilium native routing
|
||
|
|
|
||
|
|
Cilium 1.18.13, kubeProxyReplacement true, no kube-proxy, no VXLAN (cilium_vxlan device does not exist).
|
||
|
|
|
||
|
|
- routingMode: native
|
||
|
|
- autoDirectNodeRoutes: true
|
||
|
|
- ipv4NativeRoutingCIDR: 10.244.0.0/16
|
||
|
|
- enableIPv4Masquerade: true
|
||
|
|
- ipam cluster-pool 10.244.0.0/16 mask 24
|
||
|
|
- k8sServiceHost 10.10.0.2 k8sServicePort 6443
|
||
|
|
|
||
|
|
Direct routes installed:
|
||
|
|
|
||
|
|
| Node | 10.244.0.0/24 (siriussec pods) | 10.244.1.0/24 (rpi pods) | 10.244.2.0/24 (linode pods) |
|
||
|
|
|------|-------------------------------|--------------------------|------------------------------|
|
||
|
|
| siriussec | local via cilium_host 10.244.0.243 | via 10.10.0.1 dev wg0 | via 10.10.0.5 dev wg0 |
|
||
|
|
| rpi | via 10.10.0.2 dev wg0 | local via cilium_host 10.244.1.240 | via 10.10.0.5 dev wg-remote |
|
||
|
|
| linode | via 10.10.0.2 dev wg0 | via 10.10.0.1 dev wg0 | local via cilium_host 10.244.2.78 |
|
||
|
|
|
||
|
|
Packet path example — rpi host or pod to Forgejo 10.244.0.211:
|
||
|
|
1. Route: 10.244.0.211 via 10.10.0.2 dev wg0
|
||
|
|
2. WireGuard cryptokey: dest 10.244.0.0/16 matches spoke→hub AllowedIPs, encrypted to Pi
|
||
|
|
3. Pi decrypts; dest 10.244.0.0/24 matches siriussec extra_allowed_ips; encrypted to T480
|
||
|
|
4. T480 delivers via cilium_host to the pod
|
||
|
|
|
||
|
|
Verified: Pi ping+curl http://10.244.0.211:3000 → 200. Linode ping+curl → 200 (~20ms). rpi pod wget → HTTP 200.
|
||
|
|
|
||
|
|
## Public ingress
|
||
|
|
|
||
|
|
Internet → Cloudflare TLS → cloudflared (systemd on rpi) → http://192.168.1.179:8080 → Cilium Gateway hostNetwork on siriussec (label gateway=true) → HTTPRoute → Service.
|
||
|
|
|
||
|
|
Gateway: gateway-system/public, class cilium, listener HTTP 8080, allowedRoutes from All.
|
||
|
|
HTTPRoute forgejo.siriusdevops.com parentRef public/gateway-system.
|
||
|
|
Forgejo Deployment + ClusterIP 10.110.27.237:3000 and CNPG pg-1 on siriussec.
|
||
|
|
nginx is off.
|
||
|
|
|
||
|
|
Cilium Envoy on a remote node still cannot finish TCP to backends: SYN goes out wg0 sourced as reserved:ingress 10.244.1.61, SYN-ACK returns, Envoy never ACKs. Pod-to-pod and host curl over WG are fine. Pin Gateway listener to the same node as app pods. Do not bind it on rpi.
|
||
|
|
|
||
|
|
Public https://forgejo.siriusdevops.com/ → 200. LAN curl -H 'Host: forgejo.siriusdevops.com' http://192.168.1.179:8080/ → 200.
|
||
|
|
|
||
|
|
## Control plane
|
||
|
|
|
||
|
|
API only on WireGuard 10.10.0.2:6443. Legion kubectl context siriussec. GitOps repo ~/Projects/homek8s. CNPG 1 replica, local-path on siriussec /opt/local-path-provisioner.
|