homek8s/infographic/home-k8s-mesh/structured-content.md

173 lines
6.5 KiB
Markdown
Raw Normal View History

# Home kubeadm: native routing over WireGuard
## Overview
Three kubeadm nodes share a pod network by routing 10.244.0.0/16 natively across a WireGuard hub-and-spoke (Pi hub). Public HTTP terminates on Cloudflare, then hits a Cilium Gateway bound on siriussec.
## Learning Objectives
The viewer will understand:
1. Which box is the WireGuard hub vs control-plane vs cloud spoke, and which CIDRs live where
2. How a packet from the Pi (or Linode) reaches a Forgejo pod on siriussec without VXLAN
3. Why the public Gateway listener must sit on siriussec even though cloudflared runs on the Pi
---
## Section 1: Nodes
**Key Concept**: Four boxes — three Kubernetes nodes plus Legion as admin-only.
**Content**:
- rpi: traffic/worker, WG hub, cloudflared, wgportal; LAN 192.168.1.125; wg0 10.10.0.1; wg-remote 10.20.0.2; Pod CIDR 10.244.1.0/24; arm64
- siriussec (ThinkPad T480): control-plane and worker; label gateway=true; LAN 192.168.1.179; wg0 10.10.0.2; Pod CIDR 10.244.0.0/24; amd64
- linode: worker, dedicated=network PreferNoSchedule; dummy-k8s 10.10.0.5; wg0 10.20.0.1; Pod CIDR 10.244.2.0/24; amd64
- Legion: admin kubectl/k9s only — not a node; wg0 10.10.0.3
- Cluster: kubeadm v1.36.4. API https://10.10.0.2:6443 (VPN-only)
- rpi taint: dedicated=network:PreferNoSchedule
- Default pods land on siriussec
**Visual Element**:
- Type: diagram
- Subject: four labeled machine cards with role, IPs, pod CIDR
- Treatment: hub Pi larger/center; T480 and Linode as spokes; Legion dashed/admin
**Text Labels**:
- Headline: "Nodes"
- Labels: "rpi 10.10.0.1 / 10.244.1.0/24", "siriussec 10.10.0.2 / 10.244.0.0/24", "linode 10.10.0.5 / 10.244.2.0/24", "Legion 10.10.0.3 not a node", "API :6443 VPN-only"
---
## Section 2: WireGuard hub-and-spoke
**Key Concept**: Pi is the hub; Linode uses a second tunnel (wg-remote), not wg0.
**Content**:
- 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
- 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: AllowedIPs 10.20.0.0/24, 10.10.0.5/32, 10.244.2.0/24
- Linode AllowedIPs include 10.20.0.2/32, 10.10.0.0/24, 10.96.0.0/12, 10.244.0.0/16
- wgportal manages wg0 only
- ip_forward=1 on Pi, siriussec, linode
**Visual Element**:
- Type: hub-spoke diagram
- Subject: Pi center, two tunnel types (wg0 vs wg-remote) as different colored links
- Treatment: AllowedIPs printed on each link
**Text Labels**:
- Headline: "WireGuard hub-and-spoke"
- Subhead: "Pi is the hub"
- Labels: "wg0 k8s-mesh :51820", "wg-remote", "AllowedIPs 10.10.0.0/24 + 10.244.0.0/16", "extra 10.244.0.0/24 behind siriussec", "extra 10.244.2.0/24 behind linode"
---
## Section 3: Cilium native routes
**Key Concept**: No VXLAN; autoDirectNodeRoutes via WireGuard InternalIPs.
**Content**:
- Cilium 1.18.13, kubeProxyReplacement true, no kube-proxy
- routingMode: native
- autoDirectNodeRoutes: true
- ipv4NativeRoutingCIDR: 10.244.0.0/16
- cilium_vxlan device does not exist
- siriussec: 10.244.1.0/24 via 10.10.0.1 dev wg0; 10.244.2.0/24 via 10.10.0.5 dev wg0
- rpi: 10.244.0.0/24 via 10.10.0.2 dev wg0; 10.244.2.0/24 via 10.10.0.5 dev wg-remote
- linode: 10.244.0.0/24 via 10.10.0.2 dev wg0; 10.244.1.0/24 via 10.10.0.1 dev wg0
**Visual Element**:
- Type: table / route map
- Subject: per-node route rows
- Treatment: local CIDRs filled, remote CIDRs as arrows along WG
**Text Labels**:
- Headline: "Native routing — no VXLAN"
- Labels: "via 10.10.0.2 dev wg0", "via 10.10.0.5 dev wg-remote", "cilium_host local"
---
## Section 4: Packet walk to Forgejo
**Key Concept**: Dest 10.244.0.211 is cryptokey-routed to the hub, then to siriussec.
**Content**:
- Forgejo 10.244.0.211
- Route: 10.244.0.211 via 10.10.0.2 dev wg0
- WireGuard cryptokey: dest 10.244.0.0/16 matches spoke→hub AllowedIPs, encrypted to Pi
- Pi decrypts; dest 10.244.0.0/24 matches siriussec extra_allowed_ips; encrypted to T480
- T480 delivers via cilium_host to the pod
- Pi ping+curl http://10.244.0.211:3000 → 200
- Linode ping+curl → 200 (~20ms)
- rpi pod wget → HTTP 200
**Visual Element**:
- Type: numbered flow
- Subject: four hops with padlock for WG encrypt/decrypt
- Treatment: left-to-right sequence
**Text Labels**:
- Headline: "Packet to 10.244.0.211"
- Labels: "1 route via 10.10.0.2", "2 encrypt to hub", "3 extra_allowed_ips 10.244.0.0/24", "4 cilium_host → pod", "200"
---
## Section 5: Public ingress vs Envoy caveat
**Key Concept**: cloudflared is on the Pi; the Gateway listener is on siriussec because remote Envoy cannot finish TCP.
**Content**:
- Internet → Cloudflare TLS → cloudflared (systemd on rpi) → http://192.168.1.179:8080 → Cilium Gateway hostNetwork on siriussec → HTTPRoute → Service
- Gateway: gateway-system/public, listener HTTP 8080
- HTTPRoute forgejo.siriusdevops.com
- ClusterIP 10.110.27.237:3000
- nginx is off
- Cilium Envoy on a remote node: SYN sourced as reserved:ingress 10.244.1.61, SYN-ACK returns, Envoy never ACKs
- Pin Gateway listener to the same node as app pods (gateway=true)
- https://forgejo.siriusdevops.com/ → 200
- LAN curl Host forgejo.siriusdevops.com http://192.168.1.179:8080/ → 200
**Visual Element**:
- Type: flow plus callout
- Subject: public path as a gold arrow; failed Pi Envoy path as a broken red arrow
- Treatment: do-not-bind-on-rpi stamp
**Text Labels**:
- Headline: "Ingress on siriussec :8080"
- Labels: "cloudflared on rpi", "192.168.1.179:8080", "HTTPRoute", "reserved:ingress 10.244.1.61", "SYN-ACK returns, Envoy never ACKs"
---
## Data Points (Verbatim)
### Statistics
- "kubeadm v1.36.4"
- "Cilium 1.18.13"
- "API https://10.10.0.2:6443 (VPN-only)"
- "ipv4NativeRoutingCIDR: 10.244.0.0/16"
- "Forgejo 10.244.0.211"
- "Pi ping+curl http://10.244.0.211:3000 → 200"
- "Linode ping+curl → 200 (~20ms)"
- "https://forgejo.siriusdevops.com/ → 200"
- "reserved:ingress 10.244.1.61"
### Key Terms
- **routingMode: native**: Cilium setting; no VXLAN
- **autoDirectNodeRoutes**: installs pod-CIDR routes via node InternalIPs
- **extra_allowed_ips**: hub cryptokey extra networks behind a peer
- **gateway=true**: node label that binds Cilium Gateway hostNetwork :8080
---
## Design Instructions
### Style Preferences
- Personal-project neon/flashy (not quiet HUD)
- Detailed, operator-grade labels (keep exact CIDRs and IPs)
### Layout Preferences
- Diagram of how the mesh + Gateway works
- Hub-and-spoke is the real topology
### Other Requirements
- baoyu-infographic
- Language: English
- No credentials, tokens, or private keys