How to Debug DNS Resolution Failures
When DNS fails, everything fails. Here's a systematic approach to diagnosing resolution issues.
Step 1: Verify the Failure
# Quick check
nslookup api.example.com
# More detailed
dig api.example.com A
# Check from your application's perspective
getent hosts api.example.comIf dig works but your app fails, the problem is in your application's DNS configuration, not the DNS infrastructure.
Step 2: Check DNS Configuration
# View resolver configuration
cat /etc/resolv.conf
# In containers, check if DNS is inherited from host
dig @8.8.8.8 api.example.com # Test with Google DNS
dig @1.1.1.1 api.example.com # Test with Cloudflare DNSKubernetes pods use cluster DNS (CoreDNS). If external DNS works but internal names fail, the issue is with your cluster DNS.
Step 3: Trace the Resolution Path
# Full trace shows each DNS server consulted
dig +trace api.example.com
# Check specific record types
dig api.example.com CNAME
dig api.example.com AAAACommon Causes
- Stale DNS cache — flush with
systemd-resolve --flush-cachesor restart CoreDNS - Missing search domain —
resolv.confmissing the rightsearchentries - ndots configuration — Kubernetes default
ndots:5causes unnecessary lookups; set to 2 for external domains - TTL expired during outage — if the authoritative server was down during TTL expiry
- Firewall blocking UDP 53 — DNS uses UDP by default
Step 4: Check from Inside Containers
# Run a DNS debug container
kubectl run dns-debug --image=busybox --rm -it -- nslookup api.example.com
# Check CoreDNS logs
kubectl logs -n kube-system -l k8s-app=kube-dnsMonitoring DNS Health
DNS failures often cascade into application errors that look like connection timeouts. If you see a spike of timeout errors in Bugsly, check DNS resolution first — it's a common root cause that manifests as seemingly unrelated failures across your entire service.
Prevention
- Monitor DNS resolution time as a metric
- Set reasonable DNS TTLs (300s is a good default)
- Use DNS caching at the application level for high-throughput services
Try Bugsly Free
Track up to 100 issues per month on the free plan; events are not billed.
Get Started FreeRelated Articles
Setting Up Alerting in Rust
Step-by-step tutorial for configuring Bugsly alerting in Rust. Includes code snippets and optimization tips.
Read moreVue.js Error Tracking: Setup Guide with Bugsly
Set up Vue.js error tracking in minutes: install @sentry/vue, point it at a Bugsly DSN, verify a test error, then group, filter and track releases.
Read moreError Tracking for Ruby on Rails: A Setup Guide
Learn how to set up error tracking in Ruby on Rails with Bugsly. Step-by-step guide with code examples and best practices.
Read moreDistributed Tracing for Go: A Setup Guide
Complete guide to integrating Bugsly distributed tracing in your Go project. Get started in minutes with this tutorial.
Read moreFrom the same team
SEOBolt
Technical SEO and AI search audits with ready-to-apply fix plans.
Try SEOBolt →GrowFast
Domain in, qualified B2B leads out, with cold outreach and deliverability handled.
Try GrowFast →AutoShort
Turn a topic into a faceless short: AI script, voiceover and captions.
Try AutoShort →RemixViral
Paste a long video and get back the moments worth posting, cut vertical and captioned.
Try RemixViral →