Setting up a Kubernetes Cluster with kind

kind is a tool for running local Kubernetes clusters using Docker container nodes. kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI. We have uninstalled Docker in exercise 4; kind needs Docker as a prerequisite; let’s follow Exercise 4.1 steps and install Docker. Note: Docker should be installed on the node before proceeding further. To interact with our Kubernetes cluster, kubectl is the primary go to command line tool. Let us install kubectl on our node by executing these commands:

  1. Download the binary.
curl -sSL -O "https://dl.k8s.io/release/$(curl -L -s
https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  1. Modify permissions:
chmod +x kubectl
  1. Move to /usr/local/bin:
sudo mv kubectl /usr/local/bin

Now that the prerequisites are completed, we can install kind by running the following command:

  1. For AMD64 / x86_64:
[ $(uname -m) = x86_64 ] && curl -Lo ./kind
https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
  1. For ARM64:
[ $(uname -m) = aarch64 ] && curl -Lo ./kind
https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-arm64
  1. Modify permissions:
chmod +x ./kind
  1. Move the kind binary /usr/local/bin:
sudo mv ./kind /usr/local/bin/kind
  1. We will create a simple cluster with default configuration. A config file with additional configurations can be created and passed to the create cluster command during the run time. To keep it simple, we are going to make use of default configurations.
kind create cluster
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.27.3) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
  1. Verify the cluster by checking how many namespaces we have on our cluster:
kubectl get ns
NAME STATUS AGE
default Active 36s
kube-node-lease Active 36s
kube-public Active 36s
kube-system Active 36s
local-path-storage Active 30s