Files
homelab/MIGRATION_QUICKSTART.md
T
k.renner 57f6782fcc feat: Implement High Availability for Proxmox DNS Server using Keepalived
- Added Ansible playbook for installing Proxmox DNS server in HA configuration.
- Created role for Keepalived with VIP management and health checks.
- Implemented notification script for state changes in Keepalived.
- Developed health check script to monitor DNS service status.
- Configured Keepalived with VRRP settings and health check scripts.
- Documented HA architecture and deployment process for Proxmox DNS server.
- Migrated DHCP management from UniFi to Proxmox DNS server for dynamic IP resolution.
- Removed UniFi client resources from OpenTofu modules to streamline management.
- Added scripts for managing UniFi client resources during migration.
2026-02-13 21:56:26 +01:00

2.8 KiB

Quick Start: DNS Migration (HA Version)

Follow these steps in order:

Step 1: Deploy HA DNS Cluster

cd opentofu

# Deploy all 3 DNS servers with keepalived HA
tofu apply -target=module.proxmox_dns

# This creates:
# - 3 LXC containers (118, 218, 318)
# - DNS service on each
# - Keepalived with VIP 10.2.40.53

# Verify the cluster is running
for ip in 10.2.40.54 10.2.40.55 10.2.40.56; do
  echo "Checking $ip..."
  ssh root@$ip 'systemctl is-active proxmox-dns keepalived'
done

# Check which server is MASTER (has VIP)
ssh root@10.2.40.54 'ip addr show | grep 10.2.40.53'
# Should show VIP on one server

# Test DNS resolution via VIP
dig @10.2.40.53 gitea.srv.renner.uno +short

Step 2: Configure UniFi

  1. UniFi Controller > Settings > Networks
  2. Edit LAN (10.2.40.0/24)
  3. DHCP Name Server: Manual
  4. DNS Server 1: 10.2.40.53
  5. DNS Server 2: 10.2.40.1
  6. Apply Changes

Test from your laptop:

nslookup gitea.srv.renner.uno
# Should show server: 10.2.40.53

Step 3: Full Migration

cd opentofu

# This will:
# 1. Remove unifi_client resources (DHCP reservations)
# 2. VMs will continue using their static IPs for now
tofu apply

# VMs are still on static IPs at this point!

Step 4: Migrate VMs to DHCP (Optional - Can Do Later)

See DHCP_MIGRATION.md for detailed VM-by-VM migration plan.

Quick version:

# For each VM you want to migrate:
# 1. Update the .tf file: ip_address = "dhcp" (or null)
# 2. tofu apply
# 3. Reboot the VM
# 4. Verify DNS resolves new DHCP IP

What You Get Immediately

After Step 3:

  • ✅ DNS server running and resolving all VMs
  • ✅ UniFi client management removed from OpenTofu
  • ✅ VMs still have their static IPs (no changes to VMs yet)
  • ✅ No downtime

You can then migrate VMs to DHCP at your own pace.

Quick Test

After completing Step 1-3:

# From any machine on network
ping gitea.srv.renner.uno
ping grafana.srv.renner.uno
ping immich.srv.renner.uno

# All should work!

Troubleshooting

DNS servers won't start:

# Check each server
for ip in 10.2.40.54 10.2.40.55 10.2.40.56; do
  echo "=== $ip ==="
  ssh root@$ip 'journalctl -u proxmox-dns -n 20'
done
# Check for API connection errors

No server has the VIP:

# Check keepalived on all servers
for ip in 10.2.40.54 10.2.40.55 10.2.40.56; do
  echo "=== $ip ==="
  ssh root@$ip 'systemctl status keepalived'
done
# Check /var/log/keepalived-health.log for health check failures

tofu apply fails:

  • Check you have the latest code: git pull
  • Ensure vault password is set: echo $ANSIBLE_VAULT_PASSWORD_FILE
  • Try init again: tofu init

DNS not resolving:

  • Check server is running: ssh root@10.2.40.53 systemctl status proxmox-dns
  • Test locally first: dig @10.2.40.53 gitea.srv.renner.uno
  • Check your client's DNS settings: resolvectl status