Ensure the availability and performance of your domain name servers and stay ahead of potential domain resolution errors.
There are mainly two types of DNS (domain name systems): external and internal. Both kinds use the same algorithms to resolve domains. This article will focus mostly on external DNS. First, you'll learn the definition of external DNS. Then with the help of real-world use cases, you'll go through the concepts behind external DNS in greater detail.
You'll also learn about related products like GeoDNS, OpenDNS, and Google Cloud DNS. Plus you'll get a look at the external-dns utility, which people use with Kubernetes, an open-source system for managing containerized applications across multiple hosts, to manage various DNS records.
DNS is a service that turns your human-friendly domain name into a machine-friendly IP address of a server that can service your request. Every time you type in google.com or facebook.com as a URL in the browser, you're essentially asking a DNS server where exactly the requested website is located. These requests run over UDP (the user datagram protocol). It's a faster and more lightweight protocol than transmission control protocol (TCP). When you open your web browser to visit any URL, your computer will do one of these two things:
1. If you've visited the website before, the computer will use cached DNS records.
2. If you’re a first-time visitor, the recursive DNS server of your ISP will use a recursive query to find an IP address for the entered domain. It'll do this by checking its zone file in the root servers or TLD servers.
An external DNS is a publicly accessible third-party domain name server that's generally open for anyone on the internet to access and update. External DNS allows you to query for the IP address of a domain. An external DNS provider is also known as a public DNS provider. That's because anyone can use this DNS server to look up domain names.
When you want your domain to be served by a hosting provider, you have to register the domain name with that hosting company. That's delegation. It authorizes the hosting provider to be the official name server for your domain and host it for you.
Once you've successfully delegated your DNS information to a hosting provider, that provider can serve requests from its authoritative DNS servers. The provider will give you DNS information so that when a user goes to your domain name, they can access the site through your hosting provider's IP addresses and web server (which might be in the cloud).
You can compare external DNS to the postal system. When you send a letter to someone by snail mail, you don't need access to the receiver's mailbox or residence address for this process to work. All you need is the street address of the post office where your letter will go. In this case, a postal service is a kind of third-party external DNS service that you can use to send your letter.
The same principle applies to external DNS. If you have an external DNS, all you need is the DNS records that map the external domain to an external IP address. You can then configure this domain in a web server supporting external domains.
It's time to take a look at an example and examine the steps involved in DNS resolution in detail.
Step 1: A user accesses www.google.com.
Step 2: The user queries their DNS server for this domain. Generally, this is the DNS server that their internet provider assigned.
Step 3: The user's DNS server contacts its root servers. They connect until directed to the appropriate top-level domain TLD names. They're the last part of a domain name and are often associated with particular countries or geographic regions. For example, .com is for commercial entities, .gov is for United States government websites, and .uk is for United Kingdom websites.
Step 4: The user's DNS server contacts the .com TLD server and asks if Google has an external DNS.
Step 5: The .com TLD server responds with a list of IP addresses. (In this case, let's say one of them is 10.0.1.5.)
Step 6: The server then sends this information to the user's DNS server.
Step 7: The user's DNS server receives this list of IP addresses and sends it to the user to contact the appropriate IP address.
To understand how this works, let's use an example. Let's say you have an external DNS server at 10.0.1.5. It manages the domain example.com. But for some reason, this IP address changes to 10.0.1.6. (Perhaps a new VLAN, or virtual local area network, was created with an updated IP range.)
The external DNS that managed example.com would then send out a NOTIFY message to all of the other external DNS servers in the world that it knew. The DNS would tell them to update the IP address for example.com in their records.
DNS records are cached at many places. These include home routers, DHCP (dynamic host configuration protocol) servers, network switches, and servers. If your hosting provider goes down, its DNS cache will stay alive for some time and keep serving requests from the old IP addresses. However, as soon as the cache expires—usually in around 15 minutes—no one can access your site unless they know the new IP (which generally isn't the case).
To prevent this, you can register with an alternative DNS provider that provides DNS Anycast. This means that every request is served from an IP address in any one of their several data centers around the world. If one goes down, the other servers remain active and accessible. Many external DNS providers exist, such as Cloudflare, Amazon Route 53, Google Cloud DNS, and OpenDNS.
Now it's time to look into some of the common services and products related to external DNS.
Anycasting is a type of routing that lets you send packets to the closest instance of a service. It's possible by using a single IP address to point to multiple servers. When a client sends a request to the IP address, the request generally goes to the server that's closest to the client.
OpenDNS is a public provider that offers free DNS services. Open DNS offers custom filters that allow you to restrict access to specific websites. It also has a FamilyShield feature that blocks unsafe websites.
GeoDNS is a type of external DNS service that provides a way to route users to the closest server based on their geographic location. With GeoDNS, it's possible to direct users to servers in specific countries or regions to improve website performance by serving content from servers that are closer to the user. It can also block access to websites from specific areas of the world.
Google Cloud DNS is a public or external DNS service that you can use to manage your domain names and resources hosted on Google Cloud Platform (GCP). With Google Cloud DNS, you can:
External DNS services are generally for external-facing clusters. Still, developers can also use them on their local machines to test external-facing services locally.
Now you've got a basic understanding of how external DNS service works. It's time to look at applying this concept to external-facing Kubernetes clusters.
Kubernetes external-dns is a solution for managing multiple external DNS records in Kubernetes. It contains a CLI utility that deploys and configures as an external DNS service to Kubernetes clusters. Also, it offers operational simplicity by defining all your app's externally visible services as Kubernetes services and mapping their respective external-dns records to them. It allows application owners to make changes at the service level rather than an individual DNS record level.
When a pod in a Kubernetes cluster is exposed as an external service, GKE's external-dns automatically creates a corresponding external DNS record. GKE stands for Google Kubernetes engine. It's a managed Kubernetes service that makes it easy to set up, operate, and maintain clusters of Kubernetes instances.
If you have multiple Kubernetes clusters and want them to point to external DNS, you must create external DNS records manually. The Kubernetes controller constantly watches for external services and updates the external DNS records.
External DNS services provide a great way to manage your domain names and resources hosted on external providers. They offer several benefits, such as simplified management of domain names and resources, easy setup and configuration, global reach with servers across multiple data centers around the world. Cloudflare, Amazon Route 53, Google Cloud DNS, and OpenDNS are some popular external DSN services.
External DNS services are generally for external-facing clusters, but developers can also use them on their local machines to test external-facing services locally. Anycasting is a type of routing that lets you send packets to the closest instance of a service. GeoDNS is a type of external DNS service that provides a way to route users to the closest server based on their geographic location.
Kubenertes external-dns is a solution for managing multiple external DNS records in Kubernetes. It contains a CLI utility that deploys and configures as an external DNS service to Kubernetes clusters. The Kubernetes controller can constantly watch for external services and automatically update the external DNS records.
When evaluating an external DNS provider, you should consider various factors like performance, pricing and features provided to ensure you get the best service based on your need.
This post was written by Tarun Telang. Tarun is a software engineering leader with over 16 years of experience in the software industry with some of the world’s most renowned software development firms like Microsoft, Oracle, BlackBerry, and SAP. His areas of expertise include Java, web, mobile, and cloud. He’s also experienced in managing software projects using Agile and Test Driven Development methodologies.
Write for Site24x7 is a special writing program that supports writers who create content for Site24x7 “Learn” portal. Get paid for your writing.
Apply Now