Kind @ Mac in Docker and vctl container

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.

environment

Pattern using Docker container

  1. To use kind, you need go v1.14 or higher, so first install go.

    $ brew install go
    

Or $ brew upgrade go ```

  1. Add the following to ~/.zshrc to pass the go PATH.

    export PATH=$PATH:/usr/local/go/bin
    export PATH=$PATH:$(go env GOPATH)/bin
    
  2. Install kind.

    $ GO111MODULE="on" go get sigs.k8s.io/[email protected]
    
    #Confirmation of installation
    $ kind version
    v0.5.1
    
  3. Try building a single node cluster. Just run the following command:

    $ kind create cluster
    
  4. To use the kubectl command, you need to set environment variables.

  1. To delete the cluster, execute the following command.

    $ kind delete cluster --name kind
    $ unset KUBECONFIG
    
  2. 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.

Pattern using vctl container

  1. 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.

  2. 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.
    
  3. 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
    
  4. 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

Kind @ Mac in Docker and vctl container
Copy and paste the file contents in Ubuntu's Docker container
About Docker, disguise server and container
MySQL container does not start in Docker
Directly operate mariadb running in Docker container
[Docker] Start container, start bash in container, delete image
Japanese setting of mysql in Docker container
Starting with installing Docker on EC2 and running Yellowfin in a container
How to check the logs in the Docker container
[Docker] Check the running container and enter there
(Basic authentication) environment variables in rails and Docker
How to update pre-built files in docker container
Edit Docker Container in VSCode multi-stage SSH Vagrant
Small Docker container
Docker in LXD
How Docker works ~ Implement the container in 60 lines
Summary of frequently used commands in Rails and Docker
Access and debug Circle CI Docker container with ssh
A memorandum when installing Docker and building a Linux container
How to launch Swagger UI and Swagger Editor in Docker
CI/CD pipeline and Docker
Enable Docker BuildKit (mac)
Docker installation and initialization
Docker terms and commands
Docker container usage scene
Beginners install docker for mac and prepare php7.0 operating environment
Host specification when laravel php artisan serve in docker container
Install docker and docker-compose on ubuntu in the shortest process
Put Redmine docker container in Raspberry Pi 4 Model B 2GB
Japanese localization of Docker container of CentOS7 / CentOS8 and Japan time setting
Write DiscordBot to Spreadsheets Write in Ruby and run with Docker
Easily convert Java application to Docker container with Jib ~ Build with gradle and register in local repository
Organize communication in an environment that uses various resources on the host machine and Docker container