Boot-time NodePort proxies on k8s-router (CT 106)
The Cloudflare tunnels terminate on the router’s WAN address
(192.168.0.250). Because locally originated traffic does not traverse the
PREROUTING chain, each tunnel target is served by a local socat listener
which forwards to a Talos NodePort on 10.10.50.10.
The six units are managed in two places from one set of files:
| Source of truth | Purpose |
|---|---|
files/systemd/k8s-*-proxy.service | Canonical unit definitions (copied from the live container, descriptions/ordering corrected). |
router-proxy.yml | Applies them to a running CT 106: installs socat, copies units, enables + starts them. |
../router.tf | Stages the same files into the LXC entrypoint, so they are present and enabled after a recreate. |
Port map
| Unit | Listens on router | Forwards to | Used by |
|---|---|---|---|
k8s-forgejo-proxy.service | 30000/tcp | 10.10.50.10:30000 | Forgejo NodePort |
k8s-nextcloud-proxy.service | 30030/tcp | 10.10.50.10:30030 | Nextcloud NodePort |
k8s-euro-office-proxy.service | 8888/tcp | 10.10.50.10:30080 | Euro-Office via Traefik |
k8s-nginx-demo-proxy.service | 30002/tcp | 10.10.50.10:30002 | nginx-demo NodePort |
k8s-argocd-proxy.service | 30004/tcp | 10.10.50.10:30004 | Argo CD NodePort |
k8s-bureaublad-proxy.service | 30012/tcp | 10.10.50.10:30012 | bureaublad NodePort |
All units have WantedBy=multi-user.target and are ordered
After=network-online.target k8s-router.service, so they start only once the
static network and NAT/DHCP bootstrap are done. The playbook creates the
symlinks in /etc/systemd/system/multi-user.target.wants/; the router.tf
entrypoint creates the same symlinks at container creation.
Note: older notes (
routing-nodeports.md,argocd-cloudflare-tunnel.md) describe forwarding port80for Argo CD and port30020for Nextcloud. The live units use30004and30030respectively — the table above is authoritative.
Prerequisites
hosts.yml targets 192.168.0.250 as root. Unlike CT 105, the Ubuntu LXC
template does not seed the control node’s SSH key, so authorize it once:
ssh-copy-id root@192.168.0.250
If the key is elsewhere, pass it explicitly:
ansible-playbook router-proxy.yml --private-key ~/.ssh/id_ed25519
Usage
cd ansible2
ansible-playbook router-proxy.yml
The playbook is idempotent: unit files are only rewritten when they differ,
systemd daemon-reload/restarter runs only on change, and the final tasks
assert that every proxy is active and listening. To change a mapping, edit the
unit in files/systemd/, update the port in router-proxy.yml (used by the
listener check) and re-run the playbook. The same edit automatically flows into
the next tofu apply that recreates CT 106.
Verification
ssh root@192.168.0.250 \
'systemctl list-unit-files "k8s-*proxy.service"; systemctl is-active k8s-*proxy.service; ss -ltnp | grep socat'
Expected: all six units enabled and active (running), with listeners on
30000, 30030, 8888, 30002, 30004 and 30012.
Origin check (replace the port as needed):
curl -sS -o /dev/null -w '%{http_code}\n' http://192.168.0.250:30000/
Recreating CT 106
initialization.entrypoint is only executed when the container is created.
After changing files/systemd/*.service, recreate the router to apply the
bootstrap copies:
cd ..
tofu apply -refresh=false -auto-approve \
-replace=proxmox_virtual_environment_container.router \
-target=proxmox_virtual_environment_container.router
Then re-run ansible-playbook router-proxy.yml to reconcile a container that
was changed manually. See ../router_changes.md for the
router bootstrap background.