100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
DevOps

CoreDNS

AdvancedTool5.2K learners

CoreDNS is a flexible, plugin-based DNS server written in Go that serves as the default DNS provider for service discovery inside Kubernetes clusters.

Definition

CoreDNS is a flexible, plugin-based DNS server written in Go that serves as the default DNS provider for service discovery inside Kubernetes clusters.

Overview

Every service running in a Kubernetes cluster needs a way to find other services by name rather than by constantly changing IP address, and DNS is the mechanism Kubernetes uses to provide that. CoreDNS fills this role: it runs as a set of pods inside the cluster, watches the Kubernetes API for services and endpoints, and automatically serves DNS records so that a pod can resolve a service name to the correct, currently healthy address. What distinguishes CoreDNS from a traditional DNS server is its plugin-chain architecture — each plugin handles one small piece of functionality (Kubernetes service discovery, caching, logging, rewriting queries, forwarding to upstream resolvers) and plugins are composed together in a configuration file called a Corefile, making the server's behavior easy to extend or customize without modifying its core code. CoreDNS replaced kube-dns as Kubernetes' default DNS add-on and is a graduated project of the Cloud Native Computing Foundation, reflecting its central role in container networking alongside other cluster networking components like Envoy and Istio. It's typically encountered by developers indirectly, as part of how service names resolve automatically, while platform teams manage its configuration directly as part of running a Kubernetes cluster.

Key Features

  • Default DNS provider for Kubernetes service discovery since Kubernetes 1.13
  • Plugin-chain architecture for composable, customizable DNS behavior
  • Automatic DNS record generation from Kubernetes services and endpoints
  • Built-in caching, logging, and query rewriting plugins
  • Written in Go for performance and easy deployment as a container
  • CNCF graduated project with broad ecosystem adoption
  • Extensible to serve DNS beyond Kubernetes, including general-purpose zones

Use Cases

Resolving internal service names inside a Kubernetes cluster
Customizing DNS behavior through Corefile plugin configuration
Forwarding or caching external DNS queries from inside a cluster
Debugging service discovery and connectivity issues in Kubernetes
Running general-purpose authoritative or caching DNS outside Kubernetes

History

CoreDNS is a fast, flexible DNS server written in Go that also provides service discovery in cloud-native environments. The project was started in March 2016 by Miek Gieben, building on the plugin-chaining model of the Caddy web server so that DNS behavior could be composed from middleware and talk to multiple backends, including Kubernetes. CoreDNS joined the CNCF Sandbox in 2017, became an incubating project in 2018, and graduated in January 2019 — the CNCF's first graduate of that year. In Kubernetes 1.13 it replaced kube-dns as the default cluster DNS server, cementing its role as core service-discovery infrastructure for Kubernetes.

Frequently Asked Questions