Files
nix-config/hosts/12kingdoms-youko/vpn.nix
T
ryan4yin | 二花 242c607ce6 feat(k8s): reserve a VIP block and narrow the tailscale routes (#305)
Reserve 192.168.5.192/27 as a dedicated kube-vip block, outside the router's DHCP pool (.2-.99): one /29 per cluster, k3s-test-1 gets .192/29 with the API VIP at .193.

Advertise only youko itself (.183/32) and that block over Tailscale, instead of the whole /24. The /24 route shadowed hosts that are already reachable directly, e.g. idols-ai at 192.168.5.100.

Deploy prerequisites (not in this repo): approve the new Tailscale routes; point kube-vip at the new VIP; move the *.writefor.fun wildcard from .101 to .183 and update scripts/darwin_set_proxy.py, since .101 is no longer advertised.
2026-09-21 22:28:36 +08:00

29 lines
681 B
Nix

{
pkgs,
myvars,
...
}:
let
inherit (myvars.networking) hostsAddr k8sVip;
in
{
environment.systemPackages = [ pkgs.tailscale ];
services.tailscale = {
enable = true;
port = 41641;
interfaceName = "tailscale0";
# allow the Tailscale UDP port through the firewall
openFirewall = true;
useRoutingFeatures = "server";
extraSetFlags = [
# Advertise only youko itself and the k8s VIP block, not the whole /24:
# a /24 route would shadow hosts that are already reachable directly
# (e.g. idols-ai at 192.168.5.100).
"--advertise-routes=${hostsAddr.youko.ipv4}/32,${k8sVip.cidr}"
"--accept-routes=false"
];
};
}