Kind, short for Kubernetes IN Docker, is a tool designed to simplify the process of creating Kubernetes clusters for local development and testing. Leveraging Docker containers, Kind enables users to spin up Kubernetes clusters quickly and efficiently on their local machines. It provides an easy way to experiment with different Kubernetes versions, configurations, and scenarios without the need for external infrastructure. Kind’s flexibility and speed make it an ideal choice for developers and testers looking to replicate Kubernetes environments in a lightweight and portable manner.
Kind (Kubernetes IN Docker) makes it easy to create Kubernetes clusters for testing and development. Let’s dive into setting up Kind and experimenting with different configurations.
Get started by installing Kind. Visit the Kind Quick Start page for installation instructions.
Use the following commands to create a basic Kind cluster:
$ kind create cluster --name test-kind
This command sets up a default cluster with one control plane node. This is the easiest way to spin up a Kubernetes cluster.
Kind will use Docker as the default provider. Now, if you want to use Podman as the provider, you can use the following method
$ KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --name test-kind
But we want to create a multi-node Kubernetes cluster and not just a single node here. For that, we need to use the cluster configuration file. Before that, let’s delete the cluster as follows.
$ kind delete cluster
config file, for example,
~/.kube/kind_cluster, with the following content:
- role: control-plane
- role: worker
- role: worker
- role: worker
Then, create a cluster using this config:
$ kind create cluster --config ~/.kube/kind_cluster
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.27.3) 🖼
✓ Preparing nodes 📦 📦 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
✓ Joining worker nodes 🚜
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Thanks for using kind! 😊
To use a specific Kubernetes version, provide the
--image flag. For example, the following command will create the cluster with Kubernetes 1.29 version.
$ kind create cluster \
--name my-kind-cluster \
--config ~/.kube/kind_cluster \
You can replace
v1.29.0 and the SHA256 with your desired version.
After the cluster is created, Kind provides instructions for accessing it. Set the kubectl context and explore your cluster:
$ kubectl cluster-info --context kind-my-kind-cluster
Kubernetes control plane is running at https://127.0.0.1:33805
CoreDNS is running at https://127.0.0.1:33805/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
my-kind-cluster-control-plane Ready control-plane 64s v1.29.0
my-kind-cluster-worker Ready <none> 40s v1.29.0
my-kind-cluster-worker2 Ready <none> 41s v1.29.0
Now you’re ready to harness the power of Kubernetes 1.29 with Kind! Happy exploring! 😊
The views expressed and the content shared in all published articles on this website are solely those of the respective authors, and they do not necessarily reflect the views of the author’s employer or the techbeatly platform. We strive to ensure the accuracy and validity of the content published on our website. However, we cannot guarantee the absolute correctness or completeness of the information provided. It is the responsibility of the readers and users of this website to verify the accuracy and appropriateness of any information or opinions expressed within the articles. If you come across any content that you believe to be incorrect or invalid, please contact us immediately so that we can address the issue promptly.