DEV Community

Cover image for Kubernetes Cluster with Kind
martinezhenry
martinezhenry

Posted on

Kubernetes Cluster with Kind

Introduction

In this article, I will show you how you can create a Kubernetes (k8s) cluster using the tool Kind. Kind is a tool that uses docker to create the cluster nodes that may be used for local development or CI, to know more about it, you can go to the Kind official page.

Environment

  • Linux Mint 20.2
  • Docker version 20.10.12, build e91ed57

Install

To use Kind, we need to have installed Docker, How to install Docker.

After installing Docker or if already you had installed it, you need to check if the docker daemon is installed and running.

docker info
Enter fullscreen mode Exit fullscreen mode

Now you can install Kind using the steps in the Kind official docs in the install section.

This my case, I used the steps for Homebrew:

brew install kind
Enter fullscreen mode Exit fullscreen mode

After that, we can check the Kind installation with this command

kind version                                           
Enter fullscreen mode Exit fullscreen mode

You should see something like this kind v0.11.1 go1.16.4 linux/amd64

Creating a K8s Cluster

To create a k8s cluster with kind with a basic configuration you can execute this command

kind create cluster
Enter fullscreen mode Exit fullscreen mode

Output:

$ kind create cluster 
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.21.1) đŸ–ŧ
 ✓ Preparing nodes đŸ“Ļ  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹ī¸ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! 👋
Enter fullscreen mode Exit fullscreen mode

It is all, you created a k8s cluster with basic kind config, to check your cluster you can use

kind get clusters

to see your cluster name and

kind get nodes

to list nodes' names.

Output:

$ kind get clusters
kind

$ kind get nodes     
kind-control-plane
Enter fullscreen mode Exit fullscreen mode

Now you can use kubectl command to interact with your cluster. To see how to install kubectl please see this documentation install kubectl

References

Top comments (0)