RX-M kicks off its Cloud Native Short Takes series! In our first short take, Managing Partner Randy Abernethy covers the Kubernetes Orchestration Overview module. The modules gives a high-level understanding of the Kubernetes orchestration platform, outlines the goals of Kubernetes, explores Kubernetes architecture, discuss Kubernetes control plane components and node agents, and discuss various techniques for installing Kubernetes. In the video demo Randy shows how to easily install Kubernetes using the reference installer, kubeadm.
Video Transcript
Welcome to another RX-M Cloud Native Short Take. In this short take, we’re going to take a look at the Kubernetes Orchestration Overview module from RX-M.
You can’t use Kubernetes if you don’t have a Kubernetes cluster available so one of the first things that we do in this module is install Kubernetes. We need to install a container runtime, then we need to install a tool for installing Kubernetes, and then we need to actually install Kubernetes. So there’s a script up on the RX-M GitHub org in the classfiles repo called k8s.sh. Spin up a node, run that script, and you’ve got a Kubernetes cluster! It’s a single node Kubernetes cluster but it’s still a Kubernetes cluster. In the demo we walk you through installing the Kubernetes system directly so that you can see what each of the steps in the script is doing.
The first step is something similar to what I just showed you but it’s going to install Docker. So Docker has a get.docker.com URL and when you dump that into a shell it sends that shell the script that installs Docker. The first thing it’s going to do is update all your indexes in your package system so apt-get update. Next, it’s going to make sure the appropriate transports are installed to pull down packages from download.docker.com and then it adds the key for download.docker.com. Then it adds the search string to your package manager to look there for new packages. It then updates the package list that allows us to discover this docker-ce package which is where we get the Docker Community Edition. Then we’re going to install docker-ce. After a couple of seconds we get a welcome screen saying Docker is good to go and you’re running the latest version of Docker.
Next, we’re going to take the GPG for the google cloud packages and we’re going to add that to our system. This is going to allow us to install the Kubernetes installer called “kubeadm”. Now, we’re going to add the apt.kubernetes.io URL to our package manager’s list of package sources. Once we’ve done that we can actually update our package indexes and we will have the Kubernetes packages available to us. Some systems are going to have the Kubernetes packages already in their list of sources but they may be old or outdated or limited in the versions that you can get. So this is the horse’s mouth you’re going right to the main distribution for Kubernetes. You’ll be able to get whatever version you want and the latest and greatest.
Next, we’re going to install kubeadm. If you’ve never run across kubeadm, it’s the Kubernetes installer. It’s designed to install Kubernetes on a single machine which is great because you can install a control plane node then you can go to another box and use kubeadm to install a worker node and you can join them together by using kubeadm join. We use kubeadm init to set up the master and then kubeadm join to add additional control plane nodes or to add additional workers as you see fit.
Next, we set up the cluster; You have to be root to do a bunch of installation stuff so we use sudo with kubeadm which initializes a brand new cluster. When the installer runs it’s actually just making sure that all of the containers that need to run to keep a Kubernetes system running are up and ready to go. kubeadm sets all that stuff up. Its output shows that everything’s good and a cluster is ready to go. It also outputs how to join additional nodes into this cluster should we want to.
Now I’m going to run these commands right from kubeadm’s output because the installation process actually suggests just that. We do that and boom, we now have access to our cluster using kubectl. Using kubectl get pods -A where -A means “all namespaces” we see that there’s a bunch of stuff working.
Kubernetes depends on a container network interface (CNI) plugin. Before our cluster is complete, we need to add support for networking. There are lots of networking plugins that you can use and most of them will allow you to just pull a manifest down from the cloud and run it. We kubectl apply this manifest to the cluster and that’s going to stand up all the resources necessary to get the network up and running.
The last thing to do is untaint the control plane node. The little minus at the end of the taint command is removing the taint. We want to be able to run pods on our single node cluster so we remove that tait which would otherwise prevent it. Rechecking the existing pods shows us that all the control plane pods are up and running.
If I kubectl run --image nginx web, that starts up a pod. If I then kubectl get pod -o wide which lists pods in the default namespace and provides extra columns, I can see that the pod is up and running. Then I can curl it at the ip address and boom, nginx responds!
That is starting up a Kubernetes cluster. That is just one of the things you will learn in the Kubernetes Orchestration Overview module from RX-M. You can build your own custom class with the courseware builder which can include the Kubernetes Orchestration Overview module right here on the RX-M website.
That is our Cloud Native Short Take on the Kubernetes Orchestration Overview module!