Professional Documents
Culture Documents
DNS in Kubernetes - Simplified Learning
DNS in Kubernetes - Simplified Learning
DNS in Kubernetes - Simplified Learning
Us
Networking within the cluster between the different
DNS in components in the cluster such as PODs and
Introduction
DNS in Kubernetes Kubernetes
services.
Core Concepts
Core DNS in
In this tutorial, we are going to discuss about
Kubernetes Kubernetes deploys a built-in DNS server by
Scheduling DNS in the Kubernetes cluster. If you are new to
Ingress in default when you setup a cluster. If you setup
Monitoring DNS make sure you go through the prerequisite
Kubernetes Kubernetes manually, then you do it by yourself.
Application section on DNS where we discuss what DNS is,
Lifecycle what are the tools used for working with DNS We will see how that is done and how it is
Management
such as host, NS Lookup and dig utility and the configured in the next tutorial. As far as this
Cluster
different types of DNS records like A, CNAME tutorial is concerned we will see how it helps
Maintenance
etc. pods resolve other pods and services within the
Security
cluster.
Kubernetes We also discussed how to setup our own DNS
Storage
server using CoreDNS. In this tutorial we will
So we don’t really care about nodes. We focus
Networking see what names are assigned to what objects,
purely on PODs and services within the cluster.
Switching and what our service DNS records, POD DNS
As long as our cluster networking is set up
Routing records, What are the different ways you can
correctly, following the best practices we
DNS reach one part from another.
discussed so far in this section, and all pods and
Network services can get their own IP address and can
In the next tutorial, we will see how Kubernetes
Namespaces
reach each other.
implements DNS in the cluster.
About Docker
Networking Let’s start with just two PODs and a service. I
So we have a 3 node Kubernetes cluster with
Container have a test POD with the IP set to 10.244.1.5.
some PODs and services deployed on them.
Network And I have a web POD with the IP set to
Interface Each node has a node name and IP address
10.244.2.5.
assigned to it.
Cluster
Networking
The node names and IP addresses of the
POD
cluster are probably registered in a DNS server
Networking
in your organization. Now how that is managed
CNI in
Kubernetes
who accesses them are not of concern in this
tutorial.
Looking at their IPs, you can guess that they are same namespace, the default namespace.
$ curl http://web-service.apps
The service gets an IP 10.107.37.188.
Welcome to NGINX!
Whenever a service is created, the Kubernetes
DNS service creates a record for the service. It For each namespace, The DNS server creates
maps the service name to the IP address. a subdomain. All the services are grouped
$ curl http://web-service
Welcome to NGINX!
earlier. That everyone within the namespace Let’s take a closer look. web-service is the
address each other just with their first names name of the service and apps is the name of the
and to address anyone in another namespace namespace. For each namespace the DNS
you use their full names. server creates a subdomain with its name.
In this case since the test POD and the web All pods and services for a namespace are thus
POD and its associated service are all in the grouped together within a subdomain in the
name of the namespace. 244-1-5 and namespace set to default, type is
service.apps.svc.cluster.local.