Can you recite your best friend's phone number from memory? Chances are that you can't – and it's not because you're a bad friend (at least not for that reason). It's that most people don't have to remember phone numbers anymore because smartphones do that hard work for us. When we want to call someone, we type their name in, and the phone automatically looks up and dials their number for us.
Computers do essentially the same thing, thanks to DNS, which makes it possible to map the names of applications, servers, services and basically any other entity that has a network identity onto IP addresses. It also assists in processes like service discovery, which enables entities on the network to find each other. DNS is important on virtually any type of network. But it's especially critical when you're dealing with large-scale, complex environments, like those based on Kubernetes. Indeed, without DNS, the life of Kubernetes admins would be considerably more tedious.
Keep reading for a breakdown of how DNS works in Kubernetes, along with tips on how to get the most out of Kubernetes DNS.
What is DNS?
Before diving into the particulars of DNS in Kubernetes, let's talk about what DNS means in general.
DNS – short for Domain Name Service – is a type of service that translates (or resolves, to use the technical term) human-readable names to network IP addresses. For example, DNS is how your computer figures out which IP address to connect to when you want to open google.com in your browser, or when you want to send a job to a local network printer.
DNS is, in other words, akin to a phonebook for the Internet. DNS servers store records of which human-readable network address names correspond to which IP addresses, and make that information available upon request to devices, applications or services that want it.
In general, applications and services that need to resolve network names using DNS have logic built into them for connecting to DNS servers. But you can also make DNS requests manually using tools like host, a CLI utility for Unix-like operating systems. For example, if you want to see the IP addresses of the server that hosts google.com, you could type: