Docs / DNS & Domains / CoreDNS Configuration for Kubernetes

CoreDNS Configuration for Kubernetes

By Admin · Feb 17, 2026 · Updated Apr 23, 2026 · 5 views · 3 min read

Getting coredns right from the start saves hours of debugging later. In this comprehensive guide, we'll cover everything from initial setup to production-ready configuration, including kubernetes and configuration considerations.

Zone Configuration

For production deployments, consider implementing high availability by running multiple instances behind a load balancer. This approach provides both redundancy and improved performance under heavy load.


# Check DNS records
dig example.com A +short
dig example.com MX +short
dig example.com TXT +short

# Full DNS trace
dig +trace example.com

# Check specific nameserver
dig @8.8.8.8 example.com A

The output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.

Record Management

For production deployments, consider implementing high availability by running multiple instances behind a load balancer. This approach provides both redundancy and improved performance under heavy load.


# Zone file example: /etc/bind/zones/db.example.com
$TTL    86400
@       IN      SOA     ns1.example.com. admin.example.com. (
                        2024010101      ; Serial
                        3600            ; Refresh
                        1800            ; Retry
                        604800          ; Expire
                        86400 )         ; Minimum TTL

@       IN      NS      ns1.example.com.
@       IN      NS      ns2.example.com.
@       IN      A       198.51.100.10
www     IN      CNAME   @
mail    IN      A       198.51.100.11
@       IN      MX 10   mail.example.com.

These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.

Resolver Setup

The coredns configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.


# Check DNS records
dig example.com A +short
dig example.com MX +short
dig example.com TXT +short

# Full DNS trace
dig +trace example.com

# Check specific nameserver
dig @8.8.8.8 example.com A

Note that file paths may vary depending on your Linux distribution. The examples here are for Debian/Ubuntu; adjust paths accordingly for RHEL/CentOS-based systems.

Testing DNS Resolution

Performance benchmarks show that properly tuned coredns can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.


# Zone file example: /etc/bind/zones/db.example.com
$TTL    86400
@       IN      SOA     ns1.example.com. admin.example.com. (
                        2024010101      ; Serial
                        3600            ; Refresh
                        1800            ; Retry
                        604800          ; Expire
                        86400 )         ; Minimum TTL

@       IN      NS      ns1.example.com.
@       IN      NS      ns2.example.com.
@       IN      A       198.51.100.10
www     IN      CNAME   @
mail    IN      A       198.51.100.11
@       IN      MX 10   mail.example.com.

These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.

Configuration Options

Performance benchmarks show that properly tuned coredns can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.

Next Steps

With coredns now set up and running, consider implementing monitoring to track performance metrics over time. Regularly review your configuration as your workload changes and scale resources accordingly.

Was this article helpful?