kind (kubernetes in docker) kind is a tool that can build a kubernetes cluster with a Docker container as a node. In this article, after trying the pattern of building a kubernetes cluster using Docker container as usual, we will try the pattern of using VMware Fusion vctl container instead of Docker container. I referred to the article here for the Docker container pattern and here for the vctl container pattern.
To use kind, you need go v1.14 or higher, so first install go.
$ brew install go
Or $ brew upgrade go ```
Add the following to ~/.zshrc to pass the go PATH.
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$(go env GOPATH)/bin
Install kind.
$ GO111MODULE="on" go get sigs.k8s.io/[email protected]
#Confirmation of installation
$ kind version
v0.5.1
Try building a single node cluster. Just run the following command:
$ kind create cluster
To use the kubectl command, you need to set environment variables.
Since the cluster name is kind by default, specify kind in the --name option.
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
To delete the cluster, execute the following command.
$ kind delete cluster --name kind
$ unset KUBECONFIG
For the construction of multi-node cluster, please refer to the article here, so I will omit it. I was able to build it with the same procedure.
Prerequisites The required free memory varies depending on the number of nodes in the cluster to be built. It seems that 2GB of free memory is required for 1 node and 4GB for 2 nodes. Check the free memory of your Mac in advance.
Start the vctl container runtime with the following command.
$ vctl system start
Downloading 3 files...
Downloading [kubectl 93.95% kind-darwin-amd64 13.11% crx.vmdk 4.31%]
Finished kubectl 100.00%
Downloading [kind-darwin-amd64 95.58% crx.vmdk 45.76%]
Finished kind-darwin-amd64 100.00%
Downloading [crx.vmdk 97.06%]
Finished crx.vmdk 100.00%
3 files successfully downloaded.
Preparing storage...
Container storage has been prepared successfully under
/Users/****/.vctl/storage
Launching container runtime...
Container runtime has been started.
Make vctl-based kind available with the following command.
If you run $ kind version
, you'll see that it's a different version than the kind you just installed, so you've switched to a vctl-based one.
$ vctl kind
vctl-based KIND is ready now. KIND will run local Kubernetes clusters
by using vctl containers as "nodes"
* All Docker commands has been aliased to vctl in the current
terminal. Docker commands performed in current window would be
executed through vctl. If you need to use regular Docker commands,
please use a separate terminal window.
#Confirmation of installation
$ kind version
kind v0.9.0 go1.15.2 darwin/amd64
Build a cluster As with the Docker container, build a cluster with the following command.
$ kind create cluster
If the build fails, check the free memory as it may be out of memory.
$ vctl system config --k8s-mem 2g
You have successfully built a kubernetes cluster using kind. Since it is possible to build a lightweight and high-speed (single / multi-node) cluster in a local environment, I thought it would be convenient to use it as a test environment close to the actual environment. However, when building a multi-node cluster with vctl-based kind, it seems that a large amount of memory (at least 6GB of free memory is required even for 3 nodes) and some machine specifications are required, so please be patient. Please be careful.
Recommended Posts