When it comes to running a Kubernetes cluster on a local system there are multiple options but Kind provides simplicity with a near-to-real Kubernetes cluster experience as we can create a multi-node cluster as well. Minikube is another super simple option but I found it a little bit resource-heavy and slow in comparison and abstracts to only a single master node cluster.
To install Kind, follow the instructions here
We can use Kind to create a super simple Kubernetes cluster as well which competes Minikube's simplicity.
kind create cluster --name demo
(base) ~/code/devops/kubernetes/CKAD (master β) kind create cluster --name demo
Creating cluster "demo" ...
β Ensuring node image (kindest/node:v1.25.3) πΌ
β Preparing nodes π¦
β Writing configuration π
β Starting control-plane πΉοΈ
β Installing CNI π
β Installing StorageClass πΎ
Set kubectl context to "kind-demo"
You can now use your cluster with:
kubectl cluster-info --context kind-demo
Have a nice day! π
(base) ~/code/devops/kubernetes/CKAD (master β) kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:53789
CoreDNS is running at https://127.0.0.1:53789/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
(base) ~/code/devops/kubernetes/CKAD (master β)
Kind uses docker to host the Kubernetes cluster. Check the docker containers
(base) ~/code/devops/kubernetes/CKAD (master β) docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9e4a6223159d kindest/node:v1.25.3 "/usr/local/bin/entrβ¦" 6 minutes ago Up 6 minutes 127.0.0.1:53789->6443/tcp demo-control-plane
Now, to create a multi-node cluster we have to use a config file. Save the file content as kind-cluster.yaml
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
- role: worker
Now create a cluster with following command
kind create cluster --config kind-cluster.yaml
~/code/devops/kubernetes/CKAD (master β) kind create cluster --config kind-cluster.yaml
Creating cluster "kind" ...
β Ensuring node image (kindest/node:v1.25.3) πΌ
β Preparing nodes π¦ π¦ π¦
β Writing configuration π
β Starting control-plane πΉοΈ
β Installing CNI π
β Installing StorageClass πΎ
β Joining worker nodes π
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community π
you notice, this time cluster name is kind the default one if we do not provide any name.
You can explore this cluster which has one master node and two worker nodes. You can provide many other configurations as well based on your needs. Check here.
~/code/devops/kubernetes/CKAD (master β) kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kind-control-plane Ready control-plane 5m48s v1.25.3 172.18.0.4 <none> Ubuntu 22.04.1 LTS 5.10.124-linuxkit containerd://1.6.9
kind-worker Ready <none> 5m28s v1.25.3 172.18.0.3 <none> Ubuntu 22.04.1 LTS 5.10.124-linuxkit containerd://1.6.9
kind-worker2 Ready <none> 5m29s v1.25.3 172.18.0.2 <none> Ubuntu 22.04.1 LTS 5.10.124-linuxkit containerd://1.6.9
~/code/devops/kubernetes/CKAD (master β) docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
32dc5ba3b1b5 kindest/node:v1.25.3 "/usr/local/bin/entrβ¦" 6 minutes ago Up 6 minutes 127.0.0.1:53879->6443/tcp kind-control-plane
68b9e9732f8d kindest/node:v1.25.3 "/usr/local/bin/entrβ¦" 6 minutes ago Up 6 minutes kind-worker2
616c6893f374 kindest/node:v1.25.3 "/usr/local/bin/entrβ¦" 6 minutes ago Up 6 minutes kind-worker
Happy learning...
Top comments (0)