mr-karan/homelab

[question] How can host_network be working for you?

underyx opened this issue · 2 comments

Hey! I know this is not really an issue to open here, but I see lots of issues on nomad already that aren't moving, and thought I'd ask you for advice as apparently you did get this working somehow. If you don't wanna deal with questions, feel free to just close this without comment, I wouldn't mind!

Anyway, you have this Nomad config here: https://github.com/mr-karan/hydra/blob/e54cbbef89dd3e953398ffd478bcb5c8846178d8/docs/SETUP.md#configurations

I've tried like five different ways of replicating this config on my Hetzner server, the latest attempt being this: https://gitlab.com/underyx/ops/-/blob/160354829bd0b4e1003ca8e6cbb8b98e9876f48d/roles/nomad/files/nomad.hcl#L21-29

But nomad node status -json -self never reports anything about having any host_networks registered, and my caddy job always fails to allocate because it says there are no nodes with a tailscale network.

So it kinda feels like host_networks are just completely broken in Nomad. How can it be working for you? 😕

nomad node status -json -self

I didn't find any info about host_network with this command, I'm unsure if that's supposed to show up here.

Anyway, it does work for me and yes it has some rough edges which I believe some of them are fixed in 1.0.4.

nomad job inspect caddy | grep -C 5 tailscale                                    16:24:21
                        "IP": "",
                        "MBits": 0,
                        "Mode": "",
                        "ReservedPorts": [
                            {
                                "HostNetwork": "tailscale",
                                "Label": "http-internal",
                                "To": 80,
                                "Value": 80
                            },
                            {
                                "HostNetwork": "tailscale",
                                "Label": "https-internal",
                                "To": 443,
                                "Value": 443
                            },
                            {
docker ps
43eaef72b2df   mrkaran/caddy:latest       "caddy run --config …"   3 days ago     Up 3 days              100.119.138.27:80->80/tcp, 100.119.138.27:80->80/udp, 100.119.138.27:443->443/tcp, 100.119.138.27:443->443/udp, 2019/tcp                                                                 internal-6ca6aba6-b0d3-b520-fc1f-8190e3070c49

So yeah, you can see the caddy container listens on my Tailscale IP with ports defined in my Nomad spec.

Welp, thanks for getting back to me! It seems like it actually finally works for me as well, somehow :/

I just reverted to using the exact same config as you have, and caddy finally scheduled. I don't know what could've fixed it but hey, it works! Thanks a lot!