Set up local Kubernetes using Colima

220 words
This article introduces how to use Colima as a free and open-source alternative to Docker Desktop after it starts charging medium to large enterprises, allowing for quick local startup of Kubernetes.

Background

Recently, I received an email from Docker, which stated that Docker Desktop will start charging for companies with more than 250 employees or annual revenue exceeding $10 million, while individuals and small businesses can still use it for free.

text
As a reminder you're receiving this email because on August 31, 2021 we updated the terms applicable to the Docker products or services you use.

On January 31, 2022, the grace period ends for free commercial use of Docker Desktop in larger enterprises. Companies with more than 250 employees OR more than $10 million USD in annual revenue now require a paid subscription to use Docker Desktop.

What you need to know:

Docker Desktop remains free for personal use, education, non-commercial open source projects, and small businesses with fewer than 250 employees AND less than $10 million USD in annual revenue.
As a reminder you're receiving this email because on August 31, 2021 we updated the terms applicable to the Docker products or services you use.

On January 31, 2022, the grace period ends for free commercial use of Docker Desktop in larger enterprises. Companies with more than 250 employees OR more than $10 million USD in annual revenue now require a paid subscription to use Docker Desktop.

What you need to know:

Docker Desktop remains free for personal use, education, non-commercial open source projects, and small businesses with fewer than 250 employees AND less than $10 million USD in annual revenue.

I primarily use Docker Desktop to quickly start Kubernetes locally for testing. After some attempts, I discovered Colima, an excellent open-source and free alternative.

Introduction to Colima

Colima is a container runtime solution based on the Lima virtual machine, supporting macOS and Linux systems. It not only provides a complete Docker runtime environment but also has built-in Kubernetes support, perfectly replacing the container orchestration features of Docker Desktop. Compared to Docker Desktop, Colima consumes fewer resources, starts faster, and is completely open-source and free.

Installation

bash
# Install using homebrew
brew install colima

# Start docker
colima start

# Start docker (specifying VM parameters)
colima start --cpu 4 --memory 8

# Start k8s
colima start --kubernetes
# Install using homebrew
brew install colima

# Start docker
colima start

# Start docker (specifying VM parameters)
colima start --cpu 4 --memory 8

# Start k8s
colima start --kubernetes

During the startup process, Colima will automatically perform the following actions:

  • Initialize the Lima virtual machine environment
  • Configure the Docker container runtime
  • Deploy a single-node Kubernetes cluster
  • Automatically configure the kubectl context

Once started, you can use commands like docker and kubectl for verification.

Modifying Configuration

You can modify the configuration by using colima start --edit or by editing ~/.colima/default/colima.yaml, and the changes will take effect after restarting Colima.

yaml
# Virtual machine resource allocation
cpu: 4
memory: 8
disk: 100

kubernetes:
  enabled: true
  version: v1.23.0
  k3s_args:
    - --disable=traefik

docker:
  config:
    # Configure image accelerator (for domestic users)
    registry-mirrors:
      - https://docker.mirrors.ustc.edu.cn
      - https://hub-mirror.c.163.com
    # Configure insecure registry
    insecure-registries:
      - localhost:5000
# Virtual machine resource allocation
cpu: 4
memory: 8
disk: 100

kubernetes:
  enabled: true
  version: v1.23.0
  k3s_args:
    - --disable=traefik

docker:
  config:
    # Configure image accelerator (for domestic users)
    registry-mirrors:
      - https://docker.mirrors.ustc.edu.cn
      - https://hub-mirror.c.163.com
    # Configure insecure registry
    insecure-registries:
      - localhost:5000

Visual Management

Colima, as a command-line tool, does not provide a visual interface to manage Docker and K8s clusters like Docker Desktop does. However, we can obtain richer visual management features through the Kubernetes plugins available in VS Code and Jetbrains IDE.

Comments

Pleaseto continueComments require admin approval before being visible

No comments yet. Be the first to comment!