Feb 01, 2019 · ⏱ 1 minute

Bootstrapping local Kubernetes clusters using kind ⭐️

This article is the first part of a planned series of exploration into the Kubernetes ecosystem and more specifically its tooling projects. Since I'm very interested in the development of all things containers & orchestration, I thought it was a neat idea to share my impressions and provide some guidance for people that share the same interest!

For this very first post, I'll focus on kind (kubernetes-in-docker). It is a great piece of tooling created and maintained by the Kubernetes testing SIG, which primarily focuses on developing all kinds of infrastructure for testing the Kubernetes project. Out of their efforts and demands, the kind project was created, to help with bootstrapping Kubernetes clusters with ease, a workflow that is, if you're not using existing tools like Minikube, quite complicated otherwise to say the least.

You can read more about the project's design decisions in their docs, but the tl;dr is that kind simply spins up a Docker container running a single-node Kubernetes cluster with all the required dependencies like etcd, etc.

Installing kind is rather trivial, with the only requirement being having Go installed. Simply execute the following

$ go get sigs.k8s.io/kind

and optionally add $HOME/go/bin to your PATH environment variable, making the downloaded kind binary accessible. That's it - kind should be installed and executable now. Let's try to create our first kind cluster by running the following:

$ kind create cluster
Creating cluster 'kind-1' ...
✓ Ensuring node image (kindest/node:v1.13.2) 🖼
[control-plane] Creating node container 📦
[control-plane] Fixing mounts 🗻
[control-plane] Starting systemd 🖥
[control-plane] Waiting for docker to be ready 🐋
[control-plane] Pre-loading images 🐋
[control-plane] Creating the kubeadm config file
[control-plane] Starting Kubernetes (this may take a minute)
Cluster creation complete. You can now use the cluster with:
export KUBECONFIG="$(kind get kubeconfig-path --name="1")"
kubectl cluster-info

Hooray, your first kind-based Kubernetes cluster is ready to be used! You should first add the automatically generated kubeconfig file to kubectl's context, which can be done by executing the export... line (this might change depending on your operating system / shell environment) returned by the cluster creation.

The next steps to continue are up to you now, this is no longer the scope of kind's mission! And that also marks the end for this post, apart from describing obvious commands like running kind (--help) to get a list of all available commands including kind delete cluster, which is used for deleting created clusters, this is everything kind is designed to do. There's much more happening under the hood than I would have imagined before inspecting their source code, but the sheer ease of creating development environments instantly is something I've sought (and finally found) for a long time.

As always, check out the project's repository here, and hit me up if you've got questions, suggestions, and whatever else you can send by mail!