When learning a new technology project, one of the most troublesome aspects is how to quickly install the relevant environment so that your teammates can get started quickly. Learning Kubernetes is no exception. To build a Kubernetes development environment in a local environment, you need to install Docker, Kubernetes, Minikube, Kubectl and other related tools, all of which are tedious to install and configure, and prone to errors. Is there a quick way to bypass these and quickly build a Kubernetes development environment on your own computer? Apart from Minikube, you may have heard of k3s, kind and other tools, but they can be quite difficult for newcomers. Today we’re introducing a new tool, Colima, which allows you to run lightweight virtual machines in your local environment and run Kubernetes clusters in your virtual machines.
What is Colima
Colima is a lightweight virtualisation tool based on Docker that allows you to run lightweight virtual machines in a local environment. You can use Colima to build and run Kubernetes clusters in your local environment.
Colima provides a command line interface to manage VMs and containers with simple commands. It allows you to run one or more lightweight VMs locally and run Kubernetes clusters within the VMs.
Setting up a Kubernetes environment with Colima is relatively straightforward, as it automatically handles the installation and configuration of your VMs and Kubernetes. All you need to do is run the appropriate commands and Colima will deploy Kubernetes in the VM and provide you with Kubernetes management commands and a user interface.
Colima provides a fast and lightweight way to run Kubernetes on local machines and is particularly suited to development and testing needs. Please note that Colima is currently in the developer preview phase and may not yet be available for production environments. If you intend to run Kubernetes in a production environment, it is recommended that you consider using a formally supported tool or hosted service, such as a service provider that hosts a Kubernetes cluster, such as Google Kubernetes Engine (GKE), Amazon Elastic Kubernetes Service (EKS), and Microsoft Azure Kubernetes Service (AKS).
The goal of the Colima project is to install a Container Runtime environment on MacOS with minimal effort. The name Colima is also known as Container in Lima.
Install Colima
Colima can be run on Linux, macOS. You can find the installation guide for Colima on GitHub.
In addition to installing colima, you need to install brew install docker
in order to use docker runtime.
Using Colima
Colima provides a command line interface to manage VMs and containers with simple commands. It allows you to run one or more lightweight VMs locally and to run Kubernetes clusters within your VMs.
Starting Colima
You can start Colima with the colima start
command, which will automatically download and install a Docker image of Colima if you run it for the first time. If you already have Colima installed, it will start Colima.
|
|
The default profile is default
. If you want to start more profiles, you can specify them with the --profile
parameter.
Editing the Colima settings file
You can use the colima edit
command to edit Colima’s profile. If you run this command for the first time, it will automatically create a new profile. If you already have a profile, it will open the existing profile.
|
|
Note that runtime
is preset to docker
and if you want to use containerd
, you need to change the value of runtime
.
Or to add an in-house Private Registry, you can set it up via docker
.
Stop/delete Colima
To stop Colima, you can use the colima stop
command. To delete Colima, you can use the colima delete
command.
The default Profile is default
and can be specified by the -profile
parameter if you want to delete a specific Profile.
Checking Colima status
You can use the colima status
command to check the status of Colima.
where profile
can be omitted and the default is default
.
Starting a Kubernetes environment
The above tutorial allows you to quickly start a Kubernetes environment using the following commands.
|
|
The Kubernetes environment can be viewed via the kubeconfig file.
You can see that if it is a default
profile name it is colima
and if it is a foobar
profile name it is colima-foobar
. We can switch between profiles with kubectl config use-context
and we’ll start by creating a Deployment.
|
|
Use the kubectl apply
command to create a Deployment.
|
|
Check status.
You can create your own service environment to suit your needs.
Summary
Colima provides a fast and lightweight way to run Kubernetes on a local machine and is particularly suited to development and testing needs. If you want to build a Kubernetes development environment in your local environment, try Colima, which allows you to run lightweight virtual machines in your local environment and run Kubernetes clusters in your virtual machines. Developers can just concentrate on writing Yaml. Sometimes team members want to try out Kubernetes but don’t want to spend too much time installing and configuring Kubernetes, so Colima is a good choice. Of course, you can also choose Docker Desktop or Minikube or Rancher Desktop, but The advantage of Colima is that it is lightweight, and the installation and configuration process is relatively simple.
Ref
https://blog.wu-boy.com/2023/06/how-to-create-kubernetes-cluster-in-local/