1. Home
  2. Training Library
  3. DevOps
  4. Courses
  5. Deploying A Cloud Native Application into Kubernetes

K8s Cluster DNS Resolution Testing

The course is part of this learning path

Building and Deploying a Cloud Native Application
course-steps 4 certification 1 lab-steps 6
play-arrow
Start course
Overview
DifficultyAdvanced
Duration1h 26m
Students47
Ratings
5/5
star star star star star

Description

Introduction

This training course is designed to help you master the skills of deploying cloud native applications into Kubernetes.

Observe first hand the end-to-end process of deploying a sample cloud native application into a Kubernetes cluster. By taking this course you'll not only get to see firsthand the skills required to perform a robust enterprise grade deployment into Kubernetes, but you'll also be able to apply them yourself as all code and deployment assets are available for you to perform your own deployment:

https://github.com/cloudacademy/voteapp-frontend-react
https://github.com/cloudacademy/voteapp-api-go
https://github.com/cloudacademy/voteapp-k8s

Kubernetes Resources

This training course provides you with in-depth coverage and demonstrations of the following Kubernetes resources:

  1. Namespace
  2. Deployment/ReplicaSet
  3. Pod
  4. Service
  5. Ingress/Ingress Controller
  6. StatefulSet
    1. Persistent Volume
    2. Persistent Volume Claim
    3. Headless Service
  7. NetworkPolicy

Learning Objectives

What you'll learn:

  • Learn and understand the basic principles of deploying cloud native applications into a Kubenetes cluster
  • Understand how to setup and configure a locally provisioned Kubernetes cluster using Minikube
  • Understand how to work with and configure many of the key Kubernetes cluster resources such as Pods, Deployments, Services etc.
  • And finally, you’ll learn how to manage deployments and Kubernetes cluster resources through their full lifecycle.

Demonstration

This training course provides you with many hands on demonstrations where you will observe first hand how to

  • Create and provision a Minikube Kubernetes cluster
  • Install the Cilium CNI plugin
  • Build and deploy Docker containers
  • Create and configure Kubernetes resources using kubectl

Prerequisites

  • A basic understanding of containers and containerisation
  • A basic understanding of software development and the software development life cycle
  • A basic understanding of networks and networking

Intended Audience

  • Anyone interested in learning Kubernetes
  • Software Developers interested in Kubernetes containerisation, orchestration, and scheduling
  • DevOps Practitioners

Transcript

- [Instructor] Okay, welcome back. In this lecture, I'll quickly demonstrate how DNS works internally within the Cluster. And, as an example, how we can test DNS resolution for the registered services deployed as part of our sample application. 

For starters, let's view the system pods within the cluster which are used for DNS. Within the terminal, I'll run the following command: kubectl get pods --namespace= kube-system -l, for label, k8s- app=kube-dns. Now, this results in the following two CoreDNS pods which are used for DNS and have been deployed in the kube-system namespace. Next, I'll launch the following pod for DNS testing purposes which is based on the tutum/dnsutils image. This will give us the ability to run the dig utility which allows us to resolve various DNS names currently registered within our cluster.

Okay, we'll now attempt to resolve the mongo.cloudacademy.svc.cluster.local service name using the dig utility like so. Here, we can see that this results in the answer section containing the following three A records, one for each of the mongo pods where the IP address is the address assigned to the pod. This is designed like so, since the mongo service was deployed as a headless service where the ClusterIP property was set to None. Next, we'll attempt to resolve the api.cloudacademy.svc.cluster.local service record. And here we can see that it resolves differently. In this case, the answer section contains a single A record containing the VIP address, 10.101.151.37 which the cluster registered and assigned to the API service when it was deployed. 

And finally, we'll query and resolve the frontend.cloudacademy.svc.cluster.local service record. And again, we can see that the answer section contains a single A record containing the VIP address, 10.107.216.59, which the cluster registered and assigned to the frontend service when it was deployed. Let's now exit this testing pod and run a quick check on the services that are currently deployed within the cloudacademy namespace. I'll run the command: kubectl get svc, for service. And as expected the frontend and api services have the ClusterIP addresses that we've just seen when we performed DNS resolution on the cluster-registered service names. And finally, notice how the ClusterIP is set to None for the mongo service. It is this property that makes it a headless service and changes the behavior of DNS for the equivalent service record as seen earlier.

Okay that concludes this brief DNS review and testing demonstration. The key takeaway from this lecture is knowing how to query and resolve DNS names within the cluster.

About the Author

Students12091
Labs28
Courses65
Learning paths14

Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.

Jeremy holds professional certifications for both the AWS and GCP cloud platforms.