Kind
π οΈ Kind Cheat-Sheet
Kind (Kubernetes IN Docker) is a tool to run Kubernetes clusters in Docker containers. Itβs perfect for local development or CI/CD pipelines. Kind makes it easy to create multi-node Kubernetes clusters using Docker as the underlying container engine.
- Official Documentation: Kind Quick Start
π Overview
Product Type: Tool for running Kubernetes clusters in Docker containers
Focus: Local development and CI/CD pipelines
Multi-node clusters: Create Kubernetes clusters with multiple nodes (control plane and workers)
Lightweight: Runs within Docker containers, making it ideal for resource-constrained environments
Integration: Easily integrates with CI/CD pipelines for Kubernetes testing and development
Portability: Supports running Kubernetes clusters on any machine with Docker installed
βοΈ Installation on Linux
Since Kind uses Docker containers, ensure that Docker is installed and running on your system.
π₯ Install Kind
To install Kind, download the latest release and move it to /usr/local/bin
:
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.16.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
π±οΈ Cluster Management
π οΈ Cluster Creation
To create a cluster, you need to define a configuration file (kind-cluster-config.yaml
) that specifies the clusterβs desired nodes and roles. Below is an example configuration:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: testcluster
# 1 control plane node and 2 workers
nodes:
- role: control-plane
- role: worker
- role: worker
π Create the Cluster
Use the following command to create the cluster:
kind create cluster --config kind-cluster-config.yaml
You will see output similar to the following:
Creating cluster "testcluster" ...
Ensuring node image (kindest/node:v1.25.2)
Preparing nodes
Writing configuration
Starting control-plane
Installing CNI
Installing StorageClass
Joining worker nodes
Set kubectl context to "kind-testcluster"
You can now use your cluster with:
kubectl cluster-info --context kind-testcluster
π³ Check Docker Containers
To check the Docker containers running, use:
docker ps -a
The output will show containers for the control plane and worker nodes:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ac14d8c7a3c9 kindest/node:v1.25.2 "/usr/local/bin/entr..." 2 minutes ago Up About a minute testcluster-worker2
096dd4bf1718 kindest/node:v1.25.2 "/usr/local/bin/entr..." 2 minutes ago Up About a minute 127.0.0.1:42319->6443/tcp testcluster-control-plane
e1ae2d701394 kindest/node:v1.25.2 "/usr/local/bin/entr..." 2 minutes ago Up About a minute testcluster-worker
π Interacting with Your Cluster
You can have multiple Kind clusters running simultaneously. To list all your Kind clusters, use:
kind get clusters
You will see an output like:
kind
kind-2
π οΈ Set Kubernetes Context
After cluster creation, the context is automatically set to your newly created cluster. You can change contexts using tools like kubectx or manually set it with the --context
option in kubectl
.
ποΈ Cluster Deletion
To delete a Kind cluster and its associated kubeconfig, use:
kind delete cluster -n testcluster
The output will show:
Deleting cluster "testcluster" ...
π Further Information
For more tutorials, including how to manage Kind clusters with Ansible, check out:
π Resources
Official Website: Kind Official Site
Documentation: Kind Quick Start
π Related
Getting Started with Kubernetes β A guide to setting up and managing Kubernetes clusters.
Using Kubernetes with Helm β Dive deeper into Helm's features for managing Kubernetes applications.
π Explore More
Explore Kubernetes Networking to learn about networking in a containerized environment.
Dive into CI/CD Pipelines with Kind for integrating Kind in your development and deployment workflows.
Tags π
#kind #kubernetes #docker #cluster-management #local-development