Kubernetes with kind

Jonathan
4 min readDec 9, 2021

--

Quoting directly from the official site of 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.”

In my own perspective, kind is the simple way of creating a Kubernetes environment without going through the troubles of bootstrapping K8s required components. Great for quickly setting up a K8s-like environment for application development. In this article, we would be walking through the steps to install “kind” and create testing application within the environment.

Installation

  1. Install GoLang:
  • Get the latest release from here for whatever operating system (OS) you are running
  • If you are on Linux OS, please follow this article to ensure your environment recognizes GoLang
# down load the latest release from GoLang official website
wget -c https://golang.org/dl/go1.17.3.linux-amd64.tar.gz
# decompress and move the decompressed files to /usr/local
sudo tar -C /usr/local -xvzf <go1.1x.x ...>
# add the following 2 lines to the user profile
nano ~/.profile
export PATH=$PATH:/usr/local/go/bin
export GOBIN="$GOPATH/bin"
# read through the change. If you are running on VM, please restart the instance.
source ~/.profile
# verify the OS could recognize GoLang
go version

2. Install Docker

# add a group called "docker" if there is no group called this
sudo groupadd docker
# add the user into the group "docker"
sudo usermod -aG docker $USER

3. Install kubectl

  • Depending on your OS, pick the right method to follow.
  • The following could be followed if you are running on Linux OS.
# instead of using "root", use your own username
sudo install -o <username> -g <username> -m 0755 kubectl /usr/local/bin/kubectl

4. Install HELM

5. Install Kind

With all the above installed, we are finally ready to install Kind in the environment. Please follow this article for ensuring Kind is recognized in the user profile and default environment path. If you would prefer to read through the details, please refer to the official documentation of Kind.

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.8.1/kind-linux-amd64 chmod +x ./kind sudo mv ./kind /usr/local/bin
sudo mv ./kind /usr/local/bin

6. Create Kind cluster with configuration

Normally, we could just create Kind cluster with

kind create cluster

However, if you would like to create clusters with special configurations, such as Ambassador Ingress, you could create cluster like below. If you would like to know more how to use special configuration in Kind, please refer to this site.

kind create cluster --name special-kind --config='<configuration file name>'

Ambassador setup could be found here. One thing to note is that after creating the example Pods and services. Please remember to annotate the Ingress with below command so the Ingress Controller would know to look for this Ingress resource.

kubectl annotate ingress example-ingress kubernetes.io/ingress.class=ambassador

Verification

  • GoLang & Docker
  • Kubectl & HELM
  • Ambassador Ingress
  • Example Pods, Services for Ingress
  • Ingress resource with the proper annotation
  • Test Ingress

That is it! This would give a general sense on how to set up “kind” in any kind of environment available. Now, users could focus on the application development and testing them under Kubernetes container orchestrator! Happy learning!

--

--

Jonathan
Jonathan

Written by Jonathan

Started my career as a consultant, moved to support engineer, service engineer and now a product manager. Trying to be a better PM systematically every day.

No responses yet