Developed by Google, Kubernetes (also known as k8s) is a leading open-source container orchestration solution that offers a robust system for automating deployment, scaling, and managing containerized applications.
Although Kubernetes production clusters are typically in a cloud environment, with the right tool, running a Kubernetes cluster locally is not only possible but can also provide a variety of key benefits such as accelerated productivity, easy and efficient testing, and reduced resource expenditure.
Kubernetes-in-Docker (Kind) is a command-line tool that enables developers to create a local Kubernetes cluster using docker images. With this novel approach, users can take advantage of Docker’s straightforward, self-contained deployments and cleanup to create and test Kubernetes infrastructure without the operational overhead of a full-blown cluster.
In this article, we’ll take a closer look at the technology and value that Kind delivers, as well as some key use cases and benefits of local development.
Why do we need local development clusters?
The first step to understanding Kind and the value it brings to the table is to understand why developers would want a local Kubernetes development solution. There are a number of reasons to utilize a local Kubernetes cluster, for instance, the ability to test deployment methods check how the application interacts with mounted volumes, and test manifest files.
It’s not enough for developers to simply spin up a service and test it. As services are deployed to Kubernetes clusters, developers must ensure they work together with other services and communicate properly with each other. Because of this, today it is more important than ever to have the option to run a Kubernetes cluster locally.
Here are some key use cases in which local Kubernetes clusters can be particularly beneficial:
- Proof of concepts and experimentation: Using local environments eliminates the need to provide the required cloud infrastructure, security configurations, and other administrative tasks. In essence, developers will be able to experiment and carry out Proof of Concepts (POCs) in a low-risk environment.
- Smaller teams: With the differences in local machines and their respective software and configuration setups, there is a greater chance of configuration drift in large teams. However, a smaller team of experienced Kubernetes developers will be better able to standardize and align their cluster configurations based on the hardware being used, making local clusters more suitable.
- Low computation requirements: Local clusters are best suited for development environments with low computation requirements, or in other words, “simple” applications.
What is Kind?
Now that we have a better understanding of the necessity and advantages of local clusters, let’s take a closer look at Kind.
Kind is an open-source, CNCF-certified Kubernetes installer used by developers to quickly and easily create Kubernetes clusters using Docker container “nodes.” Though primarily designed for testing Kubernetes itself, Kind has proven to be an adept tool for local development and continuous integration (CI) pipelines.
As an alternative to Docker Compose, Kind is used in Go, the language in which it was developed, and can be installed on Linux, macOS, and Windows. The source code for Kind can be found in its GitHub repository.
How does Kind work?
At a high level, Kind clusters can be visualized as a single Docker container that runs a control plane node and worker nodes to form a Kubernetes cluster. Essentially, Kind bundles every Kubernetes object into a single image (called a node image), that contains all the required Kubernetes components to create a single-node or multi-node cluster.
Kind creates images, however, developers have the option to create their own image if needed. Once the Kubernetes cluster is created, kind automatically configures kubectl context, making deployment easy and robust.
Key features of Kind include:
- Support for multi-node clusters (including HA).
- Support for building Kubernetes release builds from source.
- Support for make/bash, docker, or bazel, in addition to pre-published builds.
- Can be configured to run various releases of Kubernetes (v1.16.3, v1.17.1, etc.)
What sets Kind apart from its competitors?
Kind is far from the only solution for running local clusters in Kubernetes, yet despite competing against tools such as Minkube, K3s, Microk8s, and more, Kind remains a strong contender in the market.
Here are 3 benefits that give Kind its edge:
- Simplicity. With Kind, it’s simple to set up a Kubernetes environment for local testing without needing virtual machines or anything more complicated than a Docker install. Using the tool, developers can easily create, recreate or delete a cluster with a single command. Additionally, kind enables developers to load local container images directly into the Kubernetes cluster, saving the time and effort needed to set up a registry and push the images repeatedly.
- Speed. One of the key advantages of Kind is its start-up time, which is significantly faster than similar tools such as Minikube. For instance, Kind can launch a fully compliant Kubernetes cluster using Docker containers as nodes in less than a minute, drastically improving the developer experience when testing against Kubernetes.
- Customization. Another benefit of Kind is the customization it offers. By default, Kind creates the cluster with only one node, which acts as a control plane, however, users have the option to configure kind to run in a multi-node setup and add multiple control planes to simulate high availability. Additionally, because Kind works with docker images, developers can specify a custom docker image they want to run.
Is Kind the right solution for your business?
There are a number of ways to run Kubernetes for development, and while Kind has fewer bells and whistles compared to other similar tools – what it lacks in flash, it more than makes up for in functionality.
For Kubernetes-savvy developers looking for a simple, straightforward, and flexible solution for automation, end-to-end testing, and local development – Kind is definitely a tool worth considering.
How can I learn more?
This article is part of a larger series focusing on the technologies and topics found in the first edition of the TechRadar by Devoteam. To see what our community of tech leaders said about the current position of Kind in the market, take a look at the most recent edition of the TechRadar by Devoteam.