Friday, November 6, 2020

kind(multi-node (including HA) clusters)

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.

Why kind?

  • kind supports multi-node (including HA) clusters
  • kind supports building Kubernetes release builds from source
    • support for make / bash / docker, or bazel, in addition to pre-published builds
  • kind supports Linux, macOS and Windows
  • kind is a CNCF certified conformant Kubernetes installer

Installation and usage

NOTE: kind does not require kubectl, but you will not be able to perform some of the examples in our docs without it. To install kubectl see the upstream reference here https://kubernetes.io/docs/tasks/tools/install-kubectl/
On Linux:
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64
chmod +x ./kind
mv ./kind /some-dir-in-your-PATH/kind

On Mac (homebrew):
brew install kind

On Windows:
curl.exe -Lo kind-windows-amd64.exe https://kind.sigs.k8s.io/dl/v0.9.0/kind-windows-amd64
Move-Item .\kind-windows-amd64.exe c:\some-dir-in-your-PATH\kind.exe

Creating a Cluster 

Creating a Kubernetes cluster is as simple as 
kind create cluster
kind create cluster --name kind-2

Interacting With Your Cluster

After creating a cluster, you can use kubectl to interact with it by using the configuration file generated by kind.
By default, the cluster access configuration is stored in ${HOME}/.kube/config if $KUBECONFIG environment variable is not set.
When you list your kind clusters, you will see something like the following:
kind get clusters
kind
kind-2
In order to interact with a specific cluster, you only need to specify the cluster name as a context in kubectl:
kubectl cluster-info --context kind-kind
kubectl cluster-info --context kind-kind-2


Deleting a Cluster

If you created a cluster with kind create cluster then deleting is equally simple:
kind delete cluster

If the flag --name is not specified, kind will use the default cluster context name kind and delete that cluster.

Resources: https://kind.sigs.k8s.io/docs/user/quick-start