Forgejo NodePort access via router / management host

Context

Forgejo HTTP was changed from ClusterIP to a fixed Kubernetes NodePort:

Kubernetes NodePorts are exposed on the cluster nodes (Talos nodes), not automatically on the management/LXC host.

Symptom

Accessing the management host on the NodePort fails when nothing is listening/forwarding there:

$ curl -I http://192.168.0.192:30000
curl: (7) Failed to connect to 192.168.0.192 port 30000 after 0 ms: Could not connect to server

Verification:

# Reachable on cluster nodes
$ ssh root@192.168.0.192 'for ip in 10.10.50.10 10.10.50.21 10.10.50.22; do curl -sS -o /dev/null -w "%{http_code} $ip\n" http://$ip:30000/; done'
200 10.10.50.10
200 10.10.50.21
200 10.10.50.22

# No local listener/forward on the management host
$ ssh root@192.168.0.192 'ss -ltnp | grep 30000 || echo "no listener on 192.168.0.192:30000"'
no listener on 192.168.0.192:30000

Solutions

Choose one of the following depending on where clients connect from.

1. Access a cluster node directly (simplest, if reachable)

If your client can route to the Talos subnet (10.10.50.0/24 in this environment), use any node IP:

curl -I http://10.10.50.10:30000
# or http://10.10.50.21:30000 / http://10.10.50.22:30000

NodePort is served by all nodes for the service.

2. Router / gateway port-forwarding to a cluster node

If clients are on the LAN and should reach Forgejo via a LAN/public address, configure the router (or edge firewall) to forward TCP port 30000 to a cluster node IP on port 30000, for example:

Notes:

3. Forward on the management host (192.168.0.192)

If you want 192.168.0.192:30000 to serve Forgejo (e.g. router forwards to 192.168.0.192, or LAN clients connect to it directly), add a TCP forward on that host to a cluster node.

Temporary (ad hoc, stops when the process exits):

ssh root@192.168.0.192 'socat TCP-LISTEN:30000,fork,reuseaddr TCP:10.10.50.10:30000'

Persistent options (choose per host OS/firewall management):

Also ensure the host firewall allows inbound 30000/tcp.