# Home access from the cluster Lets pods and nodes reach the home LAN at `192.168.8.0/24` (the `pop-os` workstation lives there) through the master's existing WireGuard tunnel. ``` pod on worker --Cilium--> worker node | SNAT to 169.254.8.X, GRE (outer 10.1.0.X -> 10.1.0.3) v master 10.1.0.3 | forward + MASQUERADE out wg0 (src 192.168.5.3) v home router --> 192.168.8.28 ``` Two things make this less obvious than it looks: 1. **Hetzner's private network is routed, not L2.** Each node has a `/32` (`10.1.0.x/32`) with a gateway at `10.1.0.1`; you cannot ARP a peer and use it as a next hop. 2. **It drops non-private sources.** A packet forwarded by the master with `source 192.168.8.x` never reaches the worker's NIC, so the return path has to be tunnelled as well. Hence the point-to-point GRE tunnels (`169.254.8.0/24`) between each worker and the master. The inner packet keeps its real source end to end; only the outer header uses the private node IPs. The master then masquerades `169.254.8.0/24` to `192.168.5.3` on `wg0`, the address the PC already answers. | Worker private IP | Tunnel pair | |---|---| | `10.1.0.2` | `169.254.8.0/31` (worker `.0`, master `.1`) | | `10.1.0.4` | `169.254.8.4/31` (worker `.4`, master `.5`) | The worker list is hardcoded in the DaemonSet (`WORKERS`). Update it when a node is added, removed or renumbered. ## Prerequisites (host-side, not managed here) 1. On `master-4gb-hel1-2`, the `/etc/wireguard/wg0.conf` peer for the home router must list the home LAN: ```ini AllowedIPs = 192.168.5.0/24, 192.168.8.0/24 ``` Reload with `wg syncconf wg0 <(wg-quick strip wg0)` **and** add the route if `ip route get 192.168.8.28` does not say `dev wg0` (`wg syncconf` does not install routes): ```bash ip route replace 192.168.8.0/24 dev wg0 ip route get 192.168.8.28 # expect: dev wg0 src 192.168.5.3 ``` 2. The home router routes `192.168.8.0/24` into the WireGuard tunnel and allows WireGuard ↔ LAN forwarding. 3. Hetzner Cloud Firewall `allow-all-home` includes `192.168.8.0/24`. ## Deploy ```bash kubectl apply -f HomeAccess/home_lan_router_daemonset.yaml kubectl -n kube-system rollout status ds/home-lan-router ``` The DaemonSet is privileged with `hostNetwork: true` because it programs the node's interfaces, routes and iptables. A 60 s reconcile loop re-applies everything, so reboots, drains, Cilium upgrades and iptables flushes heal themselves. ## Verify ```bash # master: tunnels, NAT kubectl -n kube-system exec ds/home-lan-router -- ip -br addr show | grep home-gw kubectl -n kube-system exec ds/home-lan-router -- iptables -t nat -S POSTROUTING | grep 192.168.8 # worker: tunnel + route kubectl -n kube-system exec -- ip route show 192.168.8.0/24 # end-to-end (ICMP is the quickest; use any listening TCP port on the PC) kubectl -n kube-system exec -- ping -c2 192.168.8.28 kubectl -n kube-system exec -- nc -vz -w2 192.168.8.28 22 kubectl -n gitea exec deploy/gitea -- curl -s -o /dev/null -w '%{http_code}\n' -m 5 http://192.168.8.28:/ ``` `` needs an HTTP listener; when nothing is running on `pop-os`, the ICMP and `nc` checks are enough. ## Notes - Only `192.168.8.0/24` becomes reachable from pods, not the rest of the home network. - `pop-os` gets its address over DHCP. The route is subnet-wide, so a lease change does not break routing; add a DHCP reservation on the UniFi gateway if anything references the address. - The worker `rp_filter` must be permissive (`0`) on the GRE interfaces and the master's `all.rp_filter` must be `0`; the DaemonSet sets both. This is what lets the forwarded, un-NAT'd reply enter the stack. - TCP MSS is clamped to `1356` (`1396` GRE inner MTU − 40) on the workers, so payloads do not black-hole on PMTUD. - The host and the containers both use the `nf_tables` iptables backend, so rules are visible and editable from either side. ## Rollback ```bash kubectl delete -f HomeAccess/home_lan_router_daemonset.yaml ``` Host state (interfaces, routes, iptables rules) survives pod deletion; remove it manually or reboot the nodes: ```bash # workers ip tunnel del home-gw iptables -t nat -D CILIUM_POST_nat -d 192.168.8.0/24 -j RETURN iptables -t nat -D POSTROUTING -s 10.0.0.0/8 -d 192.168.8.0/24 -j SNAT --to-source 169.254.8.X iptables -D FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT # master ip tunnel del home-gw-0 home-gw-4 iptables -t nat -D POSTROUTING -s 169.254.8.0/24 -d 192.168.8.0/24 -o wg0 -j MASQUERADE iptables -t nat -D POSTROUTING -s 10.0.0.0/8 -d 192.168.8.0/24 -o wg0 -j MASQUERADE iptables -D FORWARD -i 'home-gw+' -o wg0 -j ACCEPT iptables -D FORWARD -i wg0 -o 'home-gw+' -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT ```