CoreDNS: The DNS for cloud-native computing

DNS

I have a t-shirt which reads, from top to bottom: “It’s not DNS. There’s no way it’s DNS. It was DNS!” As every sysadmin knows, all too many network problems boil down to a Domain Name System (DNS) blunder. That’s already annoying, but when you have to deal with a DNS headache with fast-moving containers and cloud-native computing, DNS problems reach migraine headache levels of pain.

A double shot of aspirin answer to this pain is CoreDNS. This is a new DNS server that was designed expressly to be extensible, fast, and flexible. In short, it’s just what’s needed for containers and cloud-native computing.

Older DNS programs, such as BIND, aren’t flexible enough to deal with cloud-native computing. BIND also stores its data in files, which makes it difficult for the system to be changed fast enough to deal with container addresses, which can disappear by the time you read this paragraph.

Written in Go, the CoreDNS open-source DNS server started life as a fork of the Caddy webserver. It was meant from day one to address the fast-paced world of cloud computing.

It did this using Caddy’s extensibility model. When a program calls on CoreDNS to resolve a query, it passes the data through a chain of add-in functions, known as plugins, until one is reached that can resolve the query. This makes it easy to customize for cloud-native microservices discovery and other services.

In CoreDNS, all DNS functions, and more besides, are handled as plugins. With CoreDNS a DNS function can be any program that implements the CoreDNS Plugin application programming interface (API).

Plugins can do many things and many are already built in. For example, the 30 odd plugins CoreDNS comes with includes plugins that work with Kubernetes for service discovery and others that can read data from a file or a database.

There are also third-party external CoreDNS plugins for added functionality. These include, for instance, amazonDNS for using the Amazon DNS Server; idetcd for identifying etcd Kubernetes distributed key-value store nodes in a cluster without domain name collision; and redisc for caching DNS queries in Redis, the in-memory data structure store.

Can’t find one that does what you need? Write a plugin that does.

Each of these, in turn, can be chained together. This helps make CoreDNS far more flexible than its older DNS relatives. For example, the old way of describing DNS is as a telephone directory for the Internet. You ask for a website with its human-readable name and DNS connects you to it via its IP address.

CoreDNS does that as well, but it excels at the lesser known DNS function of enabling a service to access another service by giving it the IP address for the closest server in terms of network latency. So, for example, a container will call on, say, a microservice  from another service in the local Kubernetes cluster rather than a service in another machine milliseconds more away. When you’re working with cloud computing, that’s a big improvement.

Sound complicated? Once you get the basic concepts down, it’s not. CoreDNS also works seamlessly with Kubernetes, which makes it even more useful. The Cloud Native Computing Foundation has also recently announced that CoreDNS has graduated, marking it as a ready-for-production program.

So, if you need powerful, fast and flexible DNS for your cloud-native computing project, it’s time to get to know CoreDNS. As John Belamaric, CoreDNS senior maintainer, said, “The flexible, plugin-based architecture of CoreDNS has proven to be a powerful design for a DNS server. The ease of integrating with and extending CoreDNS has made it critical to implementing a wide variety of DNS services and use cases – from Kubernetes service discovery to policy-based DNS and ad blocking.”

Trackbacks

  1. […] CoreDNS: The DNS for cloud-native computing More> […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: