My server is almost fully converted to be managed by Uncloud, except for one service: atomdns. Which at first I didn’t mind, but now find annoying, because: uc ps doesn’t list it; my Prometheus metrics collector runs in the cluster, so it can’t easily scrape it; updates for it are different; managing means logging in onto the specific machine.

Hence I wanted it run inside the cluster. There are however a few constraints, atomdns needs:

  • IPv6;
  • Access to the host interface to send UDP notify messages with a specfic source address;
  • No proxying via Caddy’s L4 module.

To test it out I ran a test server on port 1053. This didn’t work because, even though I port forwarded 1053, for IPv6 no traffic was reaching it. Turns out my Edgerouter hides IPv6 firewall rules in the GUI… Thus after fixing that…

…Turns out that Uncloud doesn’t complain about network_mode = host, but also doesn’t actualy use it when deploying, so of course: https://github.com/psviderski/uncloud/pull/451 to fix that. With this patched in and the compose file from below:

# ss -tulpen |grep 1053
udp   UNCONN 0      0     *:1053 *:*    users:(("atomdns",pid=879898,fd=10)) ino:11762411 sk:2015 cgroup:/system.slice/docker-5784c72ba0eedc11a7d15d532f0c2039bf928a6e8fdd7a5561b497285b7da1d9.scope v6only:0 <->
tcp   LISTEN 0      4096  *:1053 *:*    users:(("atomdns",pid=879898,fd=8)) ino:11763949 sk:2024 cgroup:/system.slice/docker-5784c72ba0eedc11a7d15d532f0c2039bf928a6e8fdd7a5561b497285b7da1d9.scope v6only:0 <->

I used profiles in this compose, which is another wonderful idea from Docker:

services:
  atomdns-dev:
    profiles: ["dev"]
    image: code.atoom.net/miek/i/atomdns:latest
    x-machines:
      - nuc
    network_mode: host
    command:
      - /etc/atomdns/Conffile
    configs:
      - source: atomdns_dev_config
        target: /etc/atomdns/Conffile
      - source: miek.nl
        target: /etc/atomdns/zones/miek.nl

  atomdns_dev_config:
    content: |
      {
          log {
              debug
          }
          root /etc/atomdns
          dns {
            addr [::]:1053
          }
      }

      example.org {
        ecs
        nsid
        log
        whoami
      }
      miek.nl {
          ecs
          log
          dbfile zones/miek.nl {
              transfer {
                      to 2a01:7c8:aabc:305:5054:ff:fe32:9cd9 {
                      source 2a10:3781:2dc2:3::53
                  }
              }
          }
      }

Note that transfer snippet, was the cause for all these “problems”.

Once this is merged, I can upgrade my cluster and deploy atomdns.