nSights Talks

Kubernetes in Docker (KinD)

Tutorial Highlights & Transcript

00:00 - Beginning of video
Hello guys, I’m Luis, I’m going to be presenting KinD. So yeah.
00:19 - Agenda
So what do we have for the agenda? What we have: what is KinD, why KinD, installing KinD.
00:28 - What is KinD?
And so what is KinD, right? I’m not going to talk about the objective of being a good person, right? So KinD is the short for Kubernetes and Docker. KinD is a tool for running local Kubernetes clusters using Docker containers as notes. And it was primarily designed for testing Kubernetes itself, but may be used for local development or CI.
00:56 - Why KinD? What do you need?
So why KinD? As we mentioned, we use it for development purposes. So it should be fast and lightweight, and it would be easy to use. The only things you need to work with KinD is Docker, GO and KubeCTL is optional, but as we are going to interact with the cluster, we may need it.
01:25 - Installing KinD
So installing KinD is very straightforward. I’m using Ubuntu. So first, I need to download GO. And then I just need to run APT install colon. And after that I can install KinD, right? So I’m just going to run this, I’m not going to do it because I already have.
01:50 - Demo of KinD
So what do we have for the demo? We will create a cluster, we will interact with the cluster, we are going to create a multi node cluster, we are going to add something to the cluster, and finally remove the cluster. The first thing we need is to install KinD, right, but I have already done that. So I’m going to create a cluster, basically, we just need to type KinD, then create, cluster. And then we will type a name for the cluster. And it will be something like race. As we can see, we are going to create just a simple cluster. It’s going to create just one node. It says it is preparing nodes and reading the configuration. You have a cluster created. And we can switch context using this. Oh, well, one thing I forgot to show you that we are not running anything on Docker. So right now after the creation of the cluster, we can see that we have a couple of things running, right. Now we can see that we already have one node running on this cluster. Sorry. And yeah, but we don’t need to, like why not? Right? Maybe we can create more nodes. So I’m just going to delete this cluster very quickly. And it’s already deleted. Also we can create a cluster from a configuration file. Let me show you those files. So as we can see it is just a simple cluster with three nodes, right? One control plane and two workers. So, we are going to run KinD, create a cluster, then set the config file to be KinD demo, and give it a name. So okay, we can see that it is preparing the nodes as we can see there are three nodes. So, because we have two workers and one control plane, it will take just a couple of seconds that we are running three nodes. Like I mentioned this one for the master node and two workers. And then we can interact with the cluster. We can see that we have three nodes running right. And we can see that those nodes are running on Docker containers. We can see that we’re running some pods and some services. After that we are going to remove that cluster. We know that sometimes we need high availability clusters right? So, something that we can do is to run a cluster with multiple master nodes with KinD right. So, we can see that we are going to run a cluster with three master nodes and three worker nodes, right. So it should create six nodes, right. Create a cluster then use or config file KinD demo and we can see that it is running, it’s creating the nodes, which will be running four nodes. Okay, so we have our cluster created with the nodes. So we can see that we have all the containers running. We can see that we can create a cluster really fast. We can create highly available clusters, and we can test some other things. Also, we can create pods, just by using KubeCTL apply and then creating a new pod. And yep, and we should remove these clusters. We can remove this cluster really fast. And yeah, basically, that’s it. It’s just a quick tutorial on how to use this tool.
Jasmeet Singh

Ricardo Hernandez

DevOps Engineer

nClouds

Luis joined nClouds in 2020 as a DevOps Engineer. He is an AWS Certified Solution Architect - Associate and Hashicorp Certified - Terraform Associate.