Using Kind to experiment with Kubernetes multinode setup
I have been using Minikube for all of my Kubernetes experiments. It is great for begineers to experiment with Kubernetes. It provides the single node, single cluster setup that is more than enough for starters. As we get more and more familiar with Kubernetes it start to feel lacking on multinode setup. Recently, I had to play with multiple nodes for experiments. Thus, I was looking for a new tool that will allow me to setup multi-node multi-cluster setup. I heard about Kind from a good friend. With Kind we can create multicluster, multinode setup for Kubernetes.
What this blog is about?
This blog is about how I got Kind up and running in macOS Mojave. It is about problems that I faced during installation and how I solved them. Hopefully, it will save time for other people who are likely to face the same problem as me.
At the time of writing this article, my machine spec is as follows:
OS: macOS Mojave
version: 10.14.5 (18F132)
Processor: 2.3 GHz Intel Core i5
Memory: 16 GB 2133 MHz LPDDR3
Things needed to setup Kind
Machine requirement:
- Memory: good to have minimum of 6 GB
- CPU: nothing mentioned about it
Tools:
- Docker: it is used by Kind internally while building Kubernetes from source
- Go: it is needed to build Kubernetes from its source
- Brew: required to install missing packages. If you are using other packaging tool please follow instruction from that tool.
I assume you already know what above terms are and how to use them.
First step, always follow quick-start. I did the same and got Kind up and running in less than 10 minutes as you can see in screenshot below. Installing kind is as simple as brew install kind
Kind uses Kubernetes source directly to create cluster. So, I followed the instruction and cloned Kubernetes repo in ${GOPATH}/src/k8s.io/kubernetes using git command. you can also check GOPATH with go env
git clone https://github.com/kubernetes/kubernetes.git /Users/samundra/go/src/k8s.io/kubernetes
After clone was finished, I ran another command kind build node-image
. This command build kubernetes nodes using Kubernetes source.
This command gave me an error shown below.
`build/../build/common.sh: line 579: conditional binary operator expected`
After looking for solution came across this github issue where it mentions that the error happened because of the mis-match version of bash that was currently installed in my machine. At the time of writing, the latest bash version is 5.1.4. and I had 3.2 version installed on my machine. So I upgraded my bash using brew.
## Install $ brew upgrade bash $ brew unlink bash && brew link bash ## Open New Terminal, check bash version, should report 5.1.4 $ bash version
After bash was installed, I re-ran kind build
it failed again with another error that hinted me to install gnu-tar
package. Kind internally uses archived version of images. My guess is gnu-tar has to do something with that. I didn’t go into detail, just installed gnu-tar with brew install gnu-tar
and continued with kind.
Now, running kind build node-image
seemed to work fine as my machine fan were spinning really hard and I could hear them loud. This process took the longest, more than few minutes on my 4 cores. So, please be patience with it. My machine CPU cores went up, all 4 cores, see below. My friend named Rajendra Sharma‘s linux has 8 cores and he too saw the same thing. So, if you see this do not panic and be informed that it is expected behavior. Just open htop
and sit back and relax, have your tea/coffee. See screenshots below.
CPU usage during kind build node-image 4 core and 8 core
Below is the screenshot that shows the multi-cluster and multi-node environments that were created with Kind tool.
Kind multiple clusters
Kind multiple node
Video is available on you-tube https://www.youtube.com/watch?v=w65hXt9UMac
Please be Kind to yourself, your Devops and machines handling workloads for us – SRE
Best Regards,