kea-ha: switch from hot-standby to active/active load-balancing #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/kea-ha-load-balancing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Flips Kea's HA hook from
hot-standby(one peer serves, other warm) toload-balancing(both peers serve a deterministic hash-split of the client space). Doubles steady-state DHCP throughput ceiling, halves per-peer load.Diff
ansible/roles/kea/defaults/main.ymlkea_ha_mode: hot-standby→load-balancing;kea_ha_max_unacked_clients: 0→5ansible/roles/kea/templates/kea-dhcp4.conf.j2standby→secondary) bykea_ha_modeansible/inventory/hosts.ymlkea-02 kea_node_role: standby→secondary(informational; template no longer reads it)Why bump
max-unacked-clientsfrom 0 to 5In hot-standby,
0is fine — only the primary serves, so trippingPARTNER_DOWNon the first unacked client during a comm interruption is safe. In load-balancing, both peers are actively serving; a single packet hiccup shouldn't flip a peer toPARTNER_DOWN. ISC's recommended floor for active/active is 2–5;5rides out brief packet loss without state churn.Validation done locally
ansible-playbook playbooks/kea-render-prod.ymlrendered the new conf to/tmp/kea-prod.confon kea-01.kea-dhcp4 -t /tmp/kea-prod.confparsed clean — HA hook accepts the new mode +role: secondary.ansible-lintpasses on production profile.Rendered HA stanza:
Trade-offs
max-response-delay(60s) elapses on each, then transition toPARTNER_DOWN. The HA hook'sCOMMUNICATION_INTERRUPTED→PARTNER_DOWNmachinery bounds the window. Acceptable at homelab cardinality.Rollout plan (post-merge)
ansible-applyon push tomain; the kea role'svalidate: kea-dhcp4 -t %stask gates the file install on successful validation. Both nodes converge sequentially.restart kea-dhcp4handler bouncesisc-kea-dhcp4-serveron each node. Watch:kea_ha_local_stateflips throughWAITING→SYNCING→READY→LOAD_BALANCING.kea_ha_remote_in_touchreturns to1within ~30 s.bnkm7caa0flags any NAK / DECLINE / DROP storm in the same envelope as the per-VLAN cutover work."load-balancing"on both.Test plan
kea-dhcp4 -tvalidates rendered confansible-lintpasses on production profileansible-checkworkflow greenansible-applysucceeds, both kea nodes restart cleanlykea_ha_local_state == load-balancingon both,kea_ha_remote_in_touch == 1dora_last_success_timestamp_secondsadvances within 5 min)🤖 Generated with Claude Code
Changes the Kea HA hook from `hot-standby` (single peer serves, other warm) to `load-balancing` (both peers serve, each owns a deterministic hash bucket of the client identifier space). Doubles the steady-state DHCP throughput ceiling and cuts per-peer load roughly in half. Mechanical changes: - kea_ha_mode: hot-standby -> load-balancing - kea_ha_max_unacked_clients: 0 -> 5 Reasoning: in hot-standby `0` means trip PARTNER_DOWN on the very first un-acked client during a comm interruption — fine when only one peer is serving. In load-balancing both peers are actively serving, so a single packet hiccup shouldn't flip the surviving peer to PARTNER_DOWN. Bump to 5 per ISC guidance for active/active deployments. - kea-dhcp4.conf.j2: parameterise the second peer's role ("standby" in hot-standby, "secondary" in load-balancing). - inventory/hosts.yml: kea-02 kea_node_role -> secondary (informational; the template no longer reads this var, but keep the inventory metadata consistent.) Validation: - `ansible-playbook playbooks/kea-render-prod.yml` renders the new conf to /tmp/kea-prod.conf on kea-01. - `kea-dhcp4 -t /tmp/kea-prod.conf` validates clean — HA hook accepts the load-balancing mode + secondary peer role. - ansible-lint passes on production profile. Rollout: 1. Merge. 2. Watch CI ansible-apply on push to main; the kea role's `validate: kea-dhcp4 -t %s` task gates the file install on successful validation. Both nodes converge in series via ansible's default linear strategy. 3. The role's restart handler bounces isc-kea-dhcp4-server. On each restart watch: - `kea_ha_local_state` flips through WAITING -> SYNCING -> READY -> LOAD_BALANCING. - `kea_ha_remote_in_touch` should return to 1 within ~30s. - Monitor task (bnkm7caa0) will alert on any anomalies in the same envelope as the per-VLAN cutover work. 4. Verify post-restart from each peer: curl -u $CRED -X POST http://10.0.2.232:8001/ \ -d '{"command":"status-get","service":["dhcp4"]}' | \ jq '.[].arguments."high-availability"[].ha-mode' Expected: "load-balancing" on both. Trade-offs documented in conversation: split-brain visibility is slightly higher (both peers actively serving means a network partition has both staying live until max-response-delay elapses on each), bounded by the HA hook's COMMUNICATION_INTERRUPTED -> PARTNER_DOWN semantics. Acceptable at homelab cardinality.51a1665c7b87c0c278aa