Contents
Introduction
Architecture Review
Create K8s Cluster
Prepare Code
Build Container Images
Create K8s Resources
End-to-End Application Test
K8s Network Policies
K8s DNS
K8s Deployment Update Challenge
K8s Teardown
Summary
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:
- Namespace
- Deployment/ReplicaSet
- Pod
- Service
- Ingress/Ingress Controller
- StatefulSet
- Persistent Volume
- Persistent Volume Claim
- Headless Service
- NetworkPolicy
Learning Objectives
What you'll learn:
- Learn and understand the basic principles of deploying cloud-native applications into a Kubernetes cluster
- Understand how to set up 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 containerization
- 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 containerization, orchestration, and scheduling
- DevOps Practitioners
- [Instructor] Okay welcome back. In this lecture we will retest the full sample cloud native application within our browser.
For starters, lets first grab the copy of the front end DNS name. Now jumping back into our browser, I'll paste it in and reload the application home page like so. Brilliant! This shows that the full cloud native solution is currently deployed and hosted within our many cubed based Kubernetes cluster as working end-to-end. The fact that the details reach programming language as selected here, have now been reigned in successfully. Indicates that the required networking traffic paths, starting from the browser, through the various resources deployed within the cluster, are valid and working.
To confirm that the voting application is indeed working, let's open up developer tools, and then watch the Ajax calls being generated by the front end, and serviced by the API within the cluster when we reload the page. Here, we can filter on just the Ajax calls, by enabling the XML HTDP request filer. And now we can see the three individual Ajax requests being made, one per programming language. Each request is being sent to the API to request the details for the particular programming language. These details, if you recall, populated into the back end MongoDB database in a previous lecture. Selecting the go Ajax request, we can observe the actual API URL in HTDP headers for this request. We can say that it was sent using the get verb, and that the response code was a 200, which indicates success.
Next, if we click on the response tab, we can see the raw data response. We can also click on the preview tab, and see a formatted view of the same response like so. Let's now take a look at the equivalent Java and Nodejs Ajax request. Next, we'll clear the network pane in preparation for clicking the vote buttons. Here, we'll vote on the go language, and this in turn generates a new Ajax request. Let's now view the headers for this request. And again, we can clearly see where it is headed towards, the API. We'll vote another three times on the go language to generate some more traffic. Note also how quickly the round robin trip takes. It's quite fast, considering the various hops the request has to make, not only to the cluster, but through the resources within the cluster itself. Let's also vote once on the Java programming language. And again, we can see another Ajax request generated. Finally, let's now jump back into the terminal and take a look inside the MongoDB database to ensure that the votes are being correctly counted and saved.
We'll run the command kubectl get pods, and we'll pipe it to grep, and search on Mongo. Next, we'll jump onto this pod by executing the following command. kubectl exec -it, the pod name for this Mongo pod, and the dash command. This gets us onto the Mongo instance, where we can fire up the Mongo shell by typing in mongo. We then swap into the LangDB database, and then finally use the find method on the languages collection to view all of the documents stored within. Here we can clearly see that the current vote on the go document sitting at four, which is the expected vote count, and likewise, the vote count on the Java document is sitting at one.
Let's go back to the browser and double check this. And yes, we can see that both vote counts are synchronized. This is an excellent result and it proves our current deployment is functional. Okay, that completes the full deployment of our end-to-end cloud native application into our Kubernetes cluster. But, are we finished? Well no, not just yet. In the next lecture, we'll introduce you to network policies where we improve the security of our deployment by applying rules as to how traffic can flow between pods.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).