Deploy multi node k8s cluster with KIND in 15mins
KIND ( Kubernetes in Docker ) is a tool for running local Kubernetes clusters using docker container nodes . KIND is primarily designed for testing Kubernetes itself, but may be used for local development or CI
Installation of KIND
To install KIND we need need at least GO1.14 and docker
- Install GO1.14
Install go 1.14 with the following commands .
NOTE:- If you have previously installed a lower version of GO , delete /usr/local/go folder completely root@prasanta:~# wget “https://dl.google.com/go/$(curl https://golang.org/VERSION?m=text).linux-amd64.tar.gz"root@prasanta:~# sha256sum go1.14.2.linux-amd64.tar.gz
root@prasanta:~# tar -xvf go1.14.2.linux-amd64.tar.gz
root@prasanta:~# sudo chown -R root:root ./go
root@prasanta:~# sudo mv go /usr/localNow login with root user and add all the env variables for GO to the .bashrc export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATHroot@prasanta:~# go version
go version go1.14.2 linux/amd64
root@prasanta:~#
- Install KIND
root@prasanta:~# GO111MODULE="on" go get sigs.k8s.io/kind@v0.8.0
root@prasanta:~# kind version
kind v0.8.0 go1.14.2 linux/amd64
root@prasanta:~#
Create multi node cluster
In my previous post , I used microK8s to create single node local k8s cluster . However with KIND its very easy to create multi node cluster.
- create single node cluster without any config change . Just use the below command
kind create cluster
Get the clutser and nodes information by the below commands
- Create multi node cluster
we need to create a yml config file which represents two worker nodes and one control-plane nodes
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
Pass the config file to create cluster command
kind create cluster --config kind-config.yml
Now you can see two worker nodes created with one control-panel
root@prasanta:~# kind get nodes
kind-worker
kind-control-plane
kind-worker2
This post is referring below pages