PowerDNS on think: authoritative int zone + recursor, external-dns pdns provider #1673

Closed
opened 2026-11-05 16:59:33 +00:00 by ginjiruu · 4 comments
Owner

Part of lab/clusters#1668.

  • PowerDNS Authoritative for int.animeteamspeak.moe.
  • PowerDNS is configured by the PowerDNS Operator (powerdns-operator/PowerDNS-Operator): zones and records are Zone/ClusterZone and RRset/ClusterRRset resources in git, synced to the PowerDNS API. Nothing is configured by hand or through the API directly.
  • external-dns (PowerDNS-API provider) writes only the records it generates for Services and Ingresses, inside zones the operator owns. Drop it if the operator should be the only writer.
  • PowerDNS Recursor: forwards think.int/mini.int to each cluster's CoreDNS, public names to 1.1.1.1/8.8.8.8 (full recursion as a later switch).
  • 3 replicas on think. The old target 10.10.5.53 is in a range that no longer routes (checked 2026-11-16); pick the address under ADR-0008 (VLAN 20, lab/iac).
  • Bootstrap-critical names (OpenBao, k3s API) are NOT dependent on this: machine-configs puts them in /etc/hosts.

Done when

  • int names, cluster service names and public names all resolve via 10.10.5.53
  • Killing a replica does not interrupt resolution
Part of lab/clusters#1668. - PowerDNS Authoritative for `int.animeteamspeak.moe`. - **PowerDNS is configured by the PowerDNS Operator** ([powerdns-operator/PowerDNS-Operator](https://github.com/powerdns-operator/PowerDNS-Operator)): zones and records are `Zone`/`ClusterZone` and `RRset`/`ClusterRRset` resources in git, synced to the PowerDNS API. Nothing is configured by hand or through the API directly. - external-dns (PowerDNS-API provider) writes only the records it generates for Services and Ingresses, inside zones the operator owns. Drop it if the operator should be the only writer. - PowerDNS Recursor: forwards `think.int`/`mini.int` to each cluster's CoreDNS, public names to 1.1.1.1/8.8.8.8 (full recursion as a later switch). - 3 replicas on think. The old target 10.10.5.53 is in a range that no longer routes (checked 2026-11-16); pick the address under ADR-0008 (VLAN 20, lab/iac). - Bootstrap-critical names (OpenBao, k3s API) are NOT dependent on this: machine-configs puts them in `/etc/hosts`. ## Done when - [ ] `int` names, cluster service names and public names all resolve via 10.10.5.53 - [ ] Killing a replica does not interrupt resolution
Author
Owner

Plan (decided 2026-11-18)

Supersedes the body where they differ: the 10.10.5.53 target is dead, and the backend is LMDB, not Postgres.

Addresses (c1 LB IPAM). Two CiliumLoadBalancerIPPools over the current 10.30.100.0/24 and fdd5:c8ef:2fa0💯:/64, as start/stop ranges so they don't overlap:

  • pinned: .2-.63 (v6 ::2-::ff). Only Services labeled lbipam.animeteamspeak.moe/pool: pinned draw from it, and each one names its address with lbipam.cilium.io/ips.
  • dynamic: .64-.254 (v6 ::100 onward). Any Service without that label.
  • The existing c1 gateway (10.30.100.1, no routes yet) moves into dynamic.

Roles. Authoritative and recursive are separate processes on separate addresses.

  • Hidden primary: pdns-auth with LMDB on a linstor-csi-2r PVC, one replica (LMDB allows one instance per database). Written only through the API, by the PowerDNS Operator (zones and records as CRs in git) and by external-dns. Nothing queries it directly.
  • Secondaries: pdns-auth with LMDB on emptyDir. They resync from the primary by NOTIFY plus AXFR/IXFR, signed with TSIG. Behind a pinned auth address.
  • Zone distribution: catalog zones (LMDB supports producer and consumer, not autosecondary). One catalog for internal zones now, a separate one for public zones later. That split is how private zones stay off future public secondaries.
  • Recursor: 3 replicas behind a pinned address (10.30.100.53 plus v6). DNSSEC validation on, with a negative trust anchor for int.animeteamspeak.moe until int is signed. RPZ ad-blocking later (#1678).

Zones. All are CRs in git.

  • int.animeteamspeak.moe (parent), caosh.int.animeteamspeak.moe (site zone, per #1674), and reverse zones for 10.30.0.0/16 and fdd5:c8ef:2fa0::/48.
  • c1.caosh.int.animeteamspeak.moe (c1's cluster domain): the recursor forwards it to c1's CoreDNS over its ClusterIP. Node names and headless Services resolve LAN-wide. ClusterIPs still don't route off-cluster, so LAN-facing names go in caosh.int through external-dns, pointing at LB addresses.
  • external-dns writes only to caosh.int, with owner ID c1.

Clients (lab/iac). DHCP hands out only the recursor, so DNS fails closed when it's down, with no public fallback. The routers keep their own upstreams for NTP and PPPoE, with remote requests off. Client VLANs may reach TCP/UDP 53 and 853 only at the recursor (stops hard-coded resolvers; DoH is out of scope). The egress lock lands in the same change as the DHCP switch, never before it.

Public later (not now). The apex animeteamspeak.moe moves to the hidden primary. Public secondaries at other networks consume the public catalog only, and the registrar NS records point at them. int never leaves the internal catalog. #1708 (drop the Cloudflare wildcard) happens with the DHCP switch.

Order. One PR each, each approved before merge:

  1. c1 pool split.
  2. pdns-auth primary and secondaries, operator, zones.
  3. Recursor.
  4. external-dns.
  5. lab/iac: DHCP to the recursor, the 53/853 egress lock, Cloudflare wildcard removal.

Before any PR, a local sim proves LMDB plus the operator plus catalog zones.

## Plan (decided 2026-11-18) Supersedes the body where they differ: the `10.10.5.53` target is dead, and the backend is LMDB, not Postgres. **Addresses (c1 LB IPAM).** Two `CiliumLoadBalancerIPPool`s over the current 10.30.100.0/24 and fdd5:c8ef:2fa0:100::/64, as `start`/`stop` ranges so they don't overlap: - `pinned`: .2-.63 (v6 ::2-::ff). Only Services labeled `lbipam.animeteamspeak.moe/pool: pinned` draw from it, and each one names its address with `lbipam.cilium.io/ips`. - `dynamic`: .64-.254 (v6 ::100 onward). Any Service without that label. - The existing c1 gateway (10.30.100.1, no routes yet) moves into `dynamic`. **Roles.** Authoritative and recursive are separate processes on separate addresses. - Hidden primary: pdns-auth with LMDB on a `linstor-csi-2r` PVC, one replica (LMDB allows one instance per database). Written only through the API, by the PowerDNS Operator (zones and records as CRs in git) and by external-dns. Nothing queries it directly. - Secondaries: pdns-auth with LMDB on emptyDir. They resync from the primary by NOTIFY plus AXFR/IXFR, signed with TSIG. Behind a pinned auth address. - Zone distribution: catalog zones (LMDB supports producer and consumer, not autosecondary). One catalog for internal zones now, a separate one for public zones later. That split is how private zones stay off future public secondaries. - Recursor: 3 replicas behind a pinned address (10.30.100.53 plus v6). DNSSEC validation on, with a negative trust anchor for `int.animeteamspeak.moe` until `int` is signed. RPZ ad-blocking later (#1678). **Zones.** All are CRs in git. - `int.animeteamspeak.moe` (parent), `caosh.int.animeteamspeak.moe` (site zone, per #1674), and reverse zones for 10.30.0.0/16 and fdd5:c8ef:2fa0::/48. - `c1.caosh.int.animeteamspeak.moe` (c1's cluster domain): the recursor forwards it to c1's CoreDNS over its ClusterIP. Node names and headless Services resolve LAN-wide. ClusterIPs still don't route off-cluster, so LAN-facing names go in `caosh.int` through external-dns, pointing at LB addresses. - external-dns writes only to `caosh.int`, with owner ID `c1`. **Clients (lab/iac).** DHCP hands out only the recursor, so DNS fails closed when it's down, with no public fallback. The routers keep their own upstreams for NTP and PPPoE, with remote requests off. Client VLANs may reach TCP/UDP 53 and 853 only at the recursor (stops hard-coded resolvers; DoH is out of scope). The egress lock lands in the same change as the DHCP switch, never before it. **Public later (not now).** The apex `animeteamspeak.moe` moves to the hidden primary. Public secondaries at other networks consume the public catalog only, and the registrar NS records point at them. `int` never leaves the internal catalog. #1708 (drop the Cloudflare wildcard) happens with the DHCP switch. **Order.** One PR each, each approved before merge: 1. c1 pool split. 2. pdns-auth primary and secondaries, operator, zones. 3. Recursor. 4. external-dns. 5. lab/iac: DHCP to the recursor, the 53/853 egress lock, Cloudflare wildcard removal. Before any PR, a local sim proves LMDB plus the operator plus catalog zones.
Author
Owner

Sim results (2026-11-19, machine-configs harness)

Harness test cluster (k3s v1.37.1, Cilium, Flux), branch pdns-sim (lab/clusters), tree clusters/test/dns/. PowerDNS Auth 5.1.5 (LMDB), Recursor 5.4.9, PowerDNS Operator v0.6.0, external-dns 0.23.0 (chart 1.23.0).

Design changes forced by the sim

  1. The operator manages zones only and runs inside the primary's pod. In run 1, after the primary's database was wiped, restarting the operator brought the zones back, but its record controller ran before the zones existed, got Not Found, marked 4 of 6 records Failed, and never retried. The operator only reacts to Kubernetes events, and zone status stayed Available throughout. Now PowerDNS runs as a native sidecar, and the operator container starts once the API answers. A fresh primary therefore always comes with a fresh operator, which recreates the zones.
  2. Every record is an external-dns record. Hand-written ones are DNSEndpoint objects in git; generated ones come from annotated Services. external-dns re-asserts its records every interval and refilled a wiped primary within one cycle. PTR works through DNSEndpoint.
  3. Every zone, the catalog included, uses soa_edit_api: EPOCH. After a wipe, the recreated catalog came back with a lower serial (1795059685) than a secondary's copy (date-style 2026111901). That secondary ignored all later catalog changes until it was wiped.
  4. NOTIFY goes to each secondary individually. Secondaries run as a StatefulSet with one fixed-address Service per pod as the primary's also-notify targets. A Service-wide address reached one pod, and the other sat in freshness-check backoff for 10+ minutes.
  5. A secondary is Ready only when pdns_control list-zones reports a loaded zone. An empty secondary behind the shared Service was taking the recursor's queries.
  6. The secondary bootstrap is idempotent. A pod sandbox restart reran it on the same emptyDir and it failed on the existing zone.
  7. Configs come from a configMapGenerator. subPath mounts never update in a running pod, so a config change has to rename the ConfigMap to roll the pods.
  8. Small ones:
    • Operator CRD: spec.nameservers must not end in a dot, while record targets must.
    • external-dns 0.23 reads only external-dns.kubernetes.io/ annotations; the alpha prefix is silently ignored.
    • The operator's health port moves to :8082 (it shares the pod with the PowerDNS API on :8081).

Final run (all pass)

Test Result
Baseline: A, AAAA, PTR, Service-derived records on primary, both secondaries, recursor pass
Primary database wiped, no intervention zones and records restored automatically; the recursor kept answering from the secondaries
Primary wiped again with the EPOCH catalog catalog serial moved forward, both secondaries followed
Secondary wiped Ready in ~14 s with all zones
Record deleted in git gone from primary and both secondaries
Zone deleted in git removed from the catalog and from both secondaries
Recursor int via secondaries, cluster domain via CoreDNS, public answers with ad, dnssec-failed.org returns SERVFAIL, int has no ad (negative trust anchor)

Transient: on a fresh secondary, LMDB refused a concurrent write transaction (Unable to start RW transaction) during the first catalog sync. The member transfer retried and succeeded 9 s later.

Deferred

  • TSIG on transfers. It is per-zone metadata (TSIG-ALLOW-AXFR / AXFR-MASTER-TSIG), and the operator can't set metadata. Day one relies on allow-axfr-ips plus NetworkPolicy, which is enough for internal-only secondaries. Public secondaries will need it.
  • Delegation NS for caosh.int in the parent. external-dns writes into the most specific zone, so it would land on the child's apex instead. It isn't needed while both zones sit on the same servers and the recursor forwards int to them. It becomes needed with int signed (DS) or with separate site servers.

c1 build differs from the sim in

  • primary LMDB on linstor-csi-2r (the sim used emptyDir);
  • pinned LB addresses: auth/secondaries and the recursor at 10.30.100.53;
  • API key from an ESO generator, persisted in OpenBao (c1 has no generators yet, so that comes first).
## Sim results (2026-11-19, machine-configs harness) Harness test cluster (k3s v1.37.1, Cilium, Flux), branch `pdns-sim` (lab/clusters), tree `clusters/test/dns/`. PowerDNS Auth 5.1.5 (LMDB), Recursor 5.4.9, PowerDNS Operator v0.6.0, external-dns 0.23.0 (chart 1.23.0). ### Design changes forced by the sim 1. **The operator manages zones only and runs inside the primary's pod.** In run 1, after the primary's database was wiped, restarting the operator brought the zones back, but its record controller ran before the zones existed, got `Not Found`, marked 4 of 6 records `Failed`, and never retried. The operator only reacts to Kubernetes events, and zone status stayed `Available` throughout. Now PowerDNS runs as a native sidecar, and the operator container starts once the API answers. A fresh primary therefore always comes with a fresh operator, which recreates the zones. 2. **Every record is an external-dns record.** Hand-written ones are `DNSEndpoint` objects in git; generated ones come from annotated Services. external-dns re-asserts its records every interval and refilled a wiped primary within one cycle. PTR works through `DNSEndpoint`. 3. **Every zone, the catalog included, uses `soa_edit_api: EPOCH`.** After a wipe, the recreated catalog came back with a *lower* serial (1795059685) than a secondary's copy (date-style 2026111901). That secondary ignored all later catalog changes until it was wiped. 4. **NOTIFY goes to each secondary individually.** Secondaries run as a StatefulSet with one fixed-address Service per pod as the primary's `also-notify` targets. A Service-wide address reached one pod, and the other sat in freshness-check backoff for 10+ minutes. 5. **A secondary is Ready only when `pdns_control list-zones` reports a loaded zone.** An empty secondary behind the shared Service was taking the recursor's queries. 6. **The secondary bootstrap is idempotent.** A pod sandbox restart reran it on the same emptyDir and it failed on the existing zone. 7. **Configs come from a `configMapGenerator`.** `subPath` mounts never update in a running pod, so a config change has to rename the ConfigMap to roll the pods. 8. Small ones: - Operator CRD: `spec.nameservers` must not end in a dot, while record targets must. - external-dns 0.23 reads only `external-dns.kubernetes.io/` annotations; the `alpha` prefix is silently ignored. - The operator's health port moves to `:8082` (it shares the pod with the PowerDNS API on `:8081`). ### Final run (all pass) | Test | Result | |---|---| | Baseline: A, AAAA, PTR, Service-derived records on primary, both secondaries, recursor | pass | | Primary database wiped, no intervention | zones and records restored automatically; the recursor kept answering from the secondaries | | Primary wiped again with the EPOCH catalog | catalog serial moved forward, both secondaries followed | | Secondary wiped | Ready in ~14 s with all zones | | Record deleted in git | gone from primary and both secondaries | | Zone deleted in git | removed from the catalog and from both secondaries | | Recursor | `int` via secondaries, cluster domain via CoreDNS, public answers with `ad`, `dnssec-failed.org` returns SERVFAIL, `int` has no `ad` (negative trust anchor) | Transient: on a fresh secondary, LMDB refused a concurrent write transaction (`Unable to start RW transaction`) during the first catalog sync. The member transfer retried and succeeded 9 s later. ### Deferred - **TSIG on transfers.** It is per-zone metadata (`TSIG-ALLOW-AXFR` / `AXFR-MASTER-TSIG`), and the operator can't set metadata. Day one relies on `allow-axfr-ips` plus NetworkPolicy, which is enough for internal-only secondaries. Public secondaries will need it. - **Delegation NS for `caosh.int` in the parent.** external-dns writes into the most specific zone, so it would land on the child's apex instead. It isn't needed while both zones sit on the same servers and the recursor forwards `int` to them. It becomes needed with `int` signed (DS) or with separate site servers. ### c1 build differs from the sim in - primary LMDB on `linstor-csi-2r` (the sim used emptyDir); - pinned LB addresses: auth/secondaries and the recursor at `10.30.100.53`; - API key from an ESO generator, persisted in OpenBao (c1 has no generators yet, so that comes first).
Author
Owner

Live on c1 (2026-11-19)

Shipped as one change, #1744 (superseding #1742/#1743), plus the fix #1745. lab/iac#162 (OpenBao write grant) merged in parallel and converged without ordering.

Verified from the workstation (VLAN 30):

Check Result
resolver.caosh.int A/AAAA via recursor 10.30.100.53 10.30.100.53 / fdd5:c8ef:2fa0:100::53
ns1.int 10.30.100.11
PTR, v4 and v6 reverse zones resolve
kubernetes.default.svc.c1.caosh.int (forwarded to CoreDNS) 10.30.192.1
public example.com answers with ad
dnssec-failed.org SERVFAIL
internal names no ad (negative trust anchor)
ns1 (10.30.100.11) authoritative (aa), refuses recursion
recursor and ns1 over IPv6 UDP and TCP 5/5
API key generated once, stored at infra/apps/c1/generated/dns/pdns-api, PushSecret Synced

Rollout issues:

  1. runAsNonRoot with the images' named USER refused to start every pdns container. Fixed in #1745 with numeric uid 953.
  2. The primary StatefulSet (OrderedReady) kept its pod on the broken revision. Kubernetes' documented forced-rollback case; I deleted the pod by hand.
  3. A fresh-install deadlock (zones in a later Kustomization) was caught before merge.

All three are logged in lab/releasectl LOGBOOK.md.

Not yet: clients still get 8.8.8.8/1.1.1.1 from DHCP. The lab/iac DHCP switch + 53/853 egress lock, gated on the recursor answering, is next. The Cloudflare wildcard (#1708) needs an inventory of the public names that rely on it before it can go.

## Live on c1 (2026-11-19) Shipped as one change, #1744 (superseding #1742/#1743), plus the fix #1745. lab/iac#162 (OpenBao write grant) merged in parallel and converged without ordering. Verified from the workstation (VLAN 30): | Check | Result | |---|---| | `resolver.caosh.int` A/AAAA via recursor `10.30.100.53` | `10.30.100.53` / `fdd5:c8ef:2fa0:100::53` | | `ns1.int` | `10.30.100.11` | | PTR, v4 and v6 reverse zones | resolve | | `kubernetes.default.svc.c1.caosh.int` (forwarded to CoreDNS) | `10.30.192.1` | | public `example.com` | answers with `ad` | | `dnssec-failed.org` | SERVFAIL | | internal names | no `ad` (negative trust anchor) | | `ns1` (`10.30.100.11`) | authoritative (`aa`), refuses recursion | | recursor and ns1 over IPv6 UDP and TCP | 5/5 | | API key | generated once, stored at `infra/apps/c1/generated/dns/pdns-api`, PushSecret Synced | Rollout issues: 1. **runAsNonRoot with the images' named USER** refused to start every pdns container. Fixed in #1745 with numeric uid 953. 2. **The primary StatefulSet (`OrderedReady`) kept its pod on the broken revision.** Kubernetes' documented forced-rollback case; I deleted the pod by hand. 3. **A fresh-install deadlock** (zones in a later Kustomization) was caught before merge. All three are logged in lab/releasectl `LOGBOOK.md`. **Not yet:** clients still get 8.8.8.8/1.1.1.1 from DHCP. The lab/iac DHCP switch + 53/853 egress lock, gated on the recursor answering, is next. The Cloudflare wildcard (#1708) needs an inventory of the public names that rely on it before it can go.
Author
Owner

Closing: PowerDNS authoritative + recursor live on c1 since 2026-11-19 (#1744/#1745), clients moved in lab/iac#163/#164. Deferred TSIG and public-apex work moved to #1674/#1708.

Closing: PowerDNS authoritative + recursor live on c1 since 2026-11-19 (#1744/#1745), clients moved in lab/iac#163/#164. Deferred TSIG and public-apex work moved to #1674/#1708.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/clusters#1673
No description provided.