Kind, One More Way To Run Kubernetes In Local Env
BE KIND AND LET'S LEARN ABOUT KIND
OUR CHOICES
- For Windows and Mac users you can run Kubernetes, which comes in with Docker Desktop. And for Linux users we have option of Minikube.
INTRO TO KIND
- Minikube is a project started and managed by Kubernetes Community, which is used to run Kubernetes locally. The same community created another project called Kind which is also used for the same purpose as Minikube. So, the question comes why their are two projects created by the same community which have same objective.
KIND DEMO
- if you see this after writing kind on your command line, then you have installed it successfully
Creating Kubernetes cluster by Kind
kind create cluster --name my-cluster
- This will create a cluster with name "my-cluster". By default it will have one node. One important point here is that Kind runs Kubernetes nodes as a container. So, when we do "docker container ls" our master node is shown if we have only one node and the same node is shown when we do "kubectl get nodes"
- Now the question you might have been having is that we can also do this with the help of Minikube and Docker Desktop, so what is different in Kind. Their is more functionality in Kind.
MORE IN KIND
Loading Images
- kind load => Loads images into node from an archive or image on host
Multiple Clusters
Their is already one Kubernetes cluster in our local system with name "my-cluster", now we make another cluster with name "another-cluster". Now by "kind get clusters" we see that their are now two clusters which we can work locally, this functionality is not possible in Kubernetes and Minikube.
We can delete both the clusters by "kind delete cluster --name cluster-name".
Defining Cluster by a Config File
- In Kind we can create a cluster just by a config file which have all the functionalities of the cluster defined inside it .
DEMO
For this demo, clone github repo "github.com/vfarcic/kind-demo"
- This will create a folder named "kind-demo" in which their is multi-node.yaml file. This is a config file which defines 3 control-plane nodes and 3 worker nodes, it also allows ingress traffic and exposes itself at port 80 and 443. We can see the yaml by "cat multi-node.yaml" in kind-demo folder.
- Create cluster by "kind create cluster --config multi-node.yaml". Now when we do "kubectl get nodes" we see their are 3 master nodes and 3 worker nodes created in a cluster named "kind".
COMPARISON
- Major difference between Kind and (Minikube and Docker-Desktop {Kuberentes}) is that Kind runs inside of containers and the latter runs inside a virtual machine. So, in case of Linux(minikube) it can be beneficial to run Kind because it runs on a VM, so by using kind it will have less load on the system and it will be much faster. But the same can not by done in windows and macOS, in these we use Docker-Desktop. Docker itself run on a VM in Docker-Desktop so even if we use Kind in windows and macOS we have to use it on top of Docker-Desktop eventually.