What is kind?
kind is a tool for running Kubernetes locally. It uses
docker to create
kubelet containers, which simulates running nodes in a cluster. This makes
kind a valuable tool for local development and CI alike when testing applications designed to run on
Requirements and Installation
kind can be installed via
go install sigs.k8s.io/[email protected] # You can also install latest # go install sigs.k8s.io/kind@latest
Note: The kind Quick Start includes alternative installation instructions for using a package manager, release binaries, or the source code.
How to use kind
Once installed, a
Kubernetes cluster can be started with this command.
kind create cluster
By default, this command tells
kind to pull the latest kind node image and start a single node cluster using that image. It also sets the
name of the cluster to
To delete the cluster, run this command.
kind delete cluster
Both the create and delete commands use a default
name of kind. To create a cluster with a different
name, add the
kind create cluster --name CLUSTER_NAME
You can delete the cluster with the same flag.
kind delete cluster --name CLUSTER_NAME
Configuration and Next Steps
It is recommended that new users install
kubectl if they do not already have it. This will give us access to our
Kubernetes control plane API features. Follow the instructions for your OS in the kubectl Installation resource above.
Create a directory for your
kind project if you do not have one and navigate to it. Inside, create a
config.yaml file with any name and the following lines:
kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4
This is a minimal valid config file for a kind cluster. The file uses Kubernetes conventions for versioning and structure, so change the
v1aplha4 part of the apiVersion to the version you want to use.
Here is an example config.yaml file which maps the local port 80 to the container’s port 30000.
kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: worker extraPortMappings: - containerPort: 30000 hostPort: 80
To create a single node cluster with this example file, run the following command in the same directory:
kind create cluster --config=config.yaml
Once you are familiarized with
kind, you are ready to put your applications in
docker containers and manage them with
Kubernetes locally. Being able to access
kubectl allows you to both develop and test ways to leverage
Kubernetes API features.