Recently revisiting Golang, I built a web application and successfully ran it locally. Now, I wanted to test it in a Kubernetes cluster, but due to hardware limitations, setting up a full-fledged K8s cluster was challenging. I remembered a friend mentioning that Kubernetes can also run inside Docker—so I decided to give it a try.
Today’s focus is kind. What is kind? And what can it do?
1. Introduction to kind
kind stands for Kubernetes In Docker — a tool that uses Docker container nodes to run local Kubernetes clusters. It’s primarily designed for testing Kubernetes itself and is ideal for local development or CI pipelines.
Currently, kind supports almost all official Kubernetes versions. At present, it only supports Docker as the runtime, but future versions will gradually add support for common CRI runtimes like containerd. In the near future, support for containerd is expected to be included.
Under the hood, kind leverages open-source tools such as kubeadm and kustomize to manage cluster creation and configuration.
Enough talk — let’s get started with installing and using kind.
# kind helpkind creates and manages local Kubernetes clusters using Docker container 'nodes'Usage:
kind [command]Available Commands:
build Build one of [node-image] completion Output shell completion code for the specified shell (bash, zsh or fish) create Creates one of [cluster] delete Deletes one of [cluster]export Exports one of [kubeconfig, logs] get Gets one of [clusters, nodes, kubeconfig]help Help about any command load Loads images into nodes
version Prints the kind CLI version
Flags:
-h, --help helpfor kind
--loglevel string DEPRECATED: see -v instead
-q, --quiet silence all stderr output
-v, --verbosity int32 info log verbosity, higher value produces more output
Use "kind [command] --help"for more information about a command.
From kind help, we see that kind supports commands like build, create, delete, get, load, etc. Use -h for detailed help on subcommands.
Now, create a cluster:
Ensure ~/.kube directory exists — kind writes cluster API address, certificates, and other config into kubeconfig during setup.
# kubectl cluster-info --context kind-ci-clusterKubernetes control plane is running at https://127.0.0.1:56527
CoreDNS is running at https://127.0.0.1:56527/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Have a nice day! 👋
kind:ClusterapiVersion:kind.x-k8s.io/v1alpha4nodes:- role:control-planeimages:kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315kubeadmConfigPatches:- | kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"extraPortMappings:- containerPort:80hostPort:80protocol:TCP- containerPort:443hostPort:443protocol:TCP- role:workerimages:kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315labels:app:frontextraMounts:- hostPath:/Users/wanzi/tools/kind/wwwrootcontainerPath:/wwwroot- role:workerimages:kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315labels:app:backendextraMounts:- hostPath:/Users/wanzi/tools/kind/wwwrootcontainerPath:/wwwrootnetworking:apiServerAddress:"127.0.0.1"apiServerPort:6443podSubnet:"10.244.0.0/16"serviceSubnet:"10.96.0.0/12"# disableDefaultCNI: true # Default CNI is kindnetd; can disable to use others like CalicokubeProxyMode:"ipvs"# Set kube-proxy mode to ipvs; use "none" to disable
That concludes our journey with kind. You now have a fast, lightweight way to spin up Kubernetes clusters for testing and feature validation.