$npx -y skills add ancoleman/ai-design-components --skill managing-dnsManage DNS records, TTL strategies, and DNS-as-code automation for infrastructure. Use when configuring domain resolution, automating DNS from Kubernetes with external-dns, setting up DNS-based load balancing, or troubleshooting propagation issues across cloud providers (Route53,
| 1 | # DNS Management |
| 2 | |
| 3 | Configure and automate DNS records with proper TTL strategies, DNS-as-code patterns, and troubleshooting techniques. |
| 4 | |
| 5 | ## Purpose |
| 6 | |
| 7 | Guide DNS configuration for applications, infrastructure, and services with focus on: |
| 8 | - Record type selection (A, AAAA, CNAME, MX, TXT, SRV, CAA) |
| 9 | - TTL strategies for propagation and caching |
| 10 | - DNS-as-code automation (external-dns, OctoDNS, DNSControl) |
| 11 | - Cloud DNS services comparison and selection |
| 12 | - DNS-based load balancing patterns |
| 13 | - Troubleshooting tools and techniques |
| 14 | |
| 15 | ## When to Use This Skill |
| 16 | |
| 17 | Apply DNS management patterns when: |
| 18 | - Setting up DNS for new applications or services |
| 19 | - Automating DNS updates from Kubernetes workloads |
| 20 | - Configuring DNS-based failover or load balancing |
| 21 | - Troubleshooting DNS propagation or resolution issues |
| 22 | - Migrating DNS between providers |
| 23 | - Planning DNS changes with minimal downtime |
| 24 | - Implementing GeoDNS for global users |
| 25 | |
| 26 | ## Record Type Selection |
| 27 | |
| 28 | ### Quick Reference |
| 29 | |
| 30 | **Address Resolution:** |
| 31 | - **A Record**: Map hostname to IPv4 address (example.com → 192.0.2.1) |
| 32 | - **AAAA Record**: Map hostname to IPv6 address (example.com → 2001:db8::1) |
| 33 | - **CNAME Record**: Alias to another domain (www.example.com → example.com) |
| 34 | - Cannot use at zone apex (@) |
| 35 | - Cannot coexist with other records at same name |
| 36 | |
| 37 | **Email Configuration:** |
| 38 | - **MX Record**: Direct email to mail servers with priority |
| 39 | - **TXT Record**: Email authentication (SPF, DKIM, DMARC) and verification |
| 40 | |
| 41 | **Service Discovery:** |
| 42 | - **SRV Record**: Specify service location (protocol, priority, weight, port, target) |
| 43 | |
| 44 | **Delegation and Security:** |
| 45 | - **NS Record**: Delegate subdomain to different nameservers |
| 46 | - **CAA Record**: Restrict which Certificate Authorities can issue certificates |
| 47 | |
| 48 | **Cloud-Specific:** |
| 49 | - **ALIAS Record**: Like CNAME but works at zone apex (Route53, Cloudflare) |
| 50 | |
| 51 | ### Decision Tree |
| 52 | |
| 53 | ``` |
| 54 | Need to point domain to: |
| 55 | ├─ IPv4 Address? → A record |
| 56 | ├─ IPv6 Address? → AAAA record |
| 57 | ├─ Another Domain? |
| 58 | │ ├─ Zone apex (@) → ALIAS/ANAME or A record |
| 59 | │ └─ Subdomain → CNAME |
| 60 | ├─ Mail Server? → MX record (with priority) |
| 61 | ├─ Email Authentication? → TXT record (SPF/DKIM/DMARC) |
| 62 | ├─ Service Discovery? → SRV record |
| 63 | ├─ Domain Verification? → TXT record |
| 64 | ├─ Certificate Control? → CAA record |
| 65 | └─ Subdomain Delegation? → NS record |
| 66 | ``` |
| 67 | |
| 68 | For detailed record type examples and patterns, see `references/record-types.md`. |
| 69 | |
| 70 | ## TTL Strategy |
| 71 | |
| 72 | ### Standard TTL Values |
| 73 | |
| 74 | **By Change Frequency:** |
| 75 | - **Stable records**: 3600-86400s (1-24 hours) - NS, stable A/AAAA |
| 76 | - **Normal operation**: 3600s (1 hour) - Standard websites, MX |
| 77 | - **Moderate changes**: 300-1800s (5-30 min) - Development, A/B testing |
| 78 | - **Failover scenarios**: 60-300s (1-5 min) - Critical records needing fast updates |
| 79 | |
| 80 | **Key Principle:** Lower TTL = faster propagation but higher DNS query load |
| 81 | |
| 82 | ### Pre-Change Process |
| 83 | |
| 84 | When planning DNS changes: |
| 85 | |
| 86 | ``` |
| 87 | T-48h: Lower TTL to 300s |
| 88 | T-24h: Verify TTL propagated globally |
| 89 | T-0h: Make DNS change |
| 90 | T+1h: Verify new records propagating |
| 91 | T+6h: Confirm global propagation |
| 92 | T+24h: Raise TTL back to normal (3600s) |
| 93 | ``` |
| 94 | |
| 95 | **Propagation Formula:** `Max Time = Old TTL + New TTL + Query Time` |
| 96 | |
| 97 | Example: Changing a record with 3600s TTL takes up to 2 hours to fully propagate. |
| 98 | |
| 99 | ### TTL by Use Case |
| 100 | |
| 101 | | Use Case | TTL | Rationale | |
| 102 | |----------|-----|-----------| |
| 103 | | Production (stable) | 3600s | Balance speed and load | |
| 104 | | Before planned change | 300s | Fast propagation | |
| 105 | | Development/staging | 300-600s | Frequent changes | |
| 106 | | DNS-based failover | 60-300s | Fast recovery | |
| 107 | | Mail servers | 3600s | Rarely change | |
| 108 | | NS records | 86400s | Very stable | |
| 109 | |
| 110 | For detailed TTL scenarios and calculations, see `references/ttl-strategies.md`. |
| 111 | |
| 112 | ## DNS-as-Code Tools |
| 113 | |
| 114 | ### Tool Selection by Use Case |
| 115 | |
| 116 | **Kubernetes DNS Automation → external-dns** |
| 117 | - Annotation-based configuration on Services/Ingresses |
| 118 | - Automatic sync to DNS providers (20+ supported) |
| 119 | - No manual DNS updates required |
| 120 | - See `examples/external-dns/` |
| 121 | |
| 122 | **Multi-Provider DNS Management → OctoDNS or DNSControl** |
| 123 | - Version control for DNS records |
| 124 | - Sync configuration across multiple providers |
| 125 | - Preview changes before applying |
| 126 | - OctoDNS (Python/YAML) - See `examples/octodns/` |
| 127 | - DNSControl (JavaScript) - See `examples/dnscontrol/` |
| 128 | |
| 129 | **Infrastructure-as-Code → Terraform** |
| 130 | - Manage DNS alongside cloud resources |
| 131 | - Provider-specific resources (aws_route53_record, etc.) |
| 132 | - See `examples/terraform/` |
| 133 | |
| 134 | ### Tool Comparison |
| 135 | |
| 136 | | Tool | Language | Best For | Kubernetes | Multi-Provider | |
| 137 | |------|----------|----------|------------|----------------| |
| 138 | | external-dns | Go | K8s automation | ★★★★★ | ★★★★ | |
| 139 | | OctoDNS | Python/YAML | Version control | ★★★ | ★★★★★ | |
| 140 | | DNSControl | Java |