Infrastructure at your Service

Saïd Mendi

Working with multipass, a VM manager

Introduction

What if you need quickly to launch virtual machine instances running Ubuntu for development and testing purposes.
Multipass from Canonical can be the right tool for this. You can even customize the instances during launch by using Cloud-init in order to simulate a small cloud deployment from your laptop or desktop.
So, in this short blog post, I will talk about this tool and demonstrate how easy it is to use it.

Introduction

Multipass is a lightweight Virtual Machines Manager (VMs) and can be the ideal way for launching VM’s for developers.
It can be installed either on Linux, MacOs or Windows.
Multipass use KVM on linux, Hyperkit on MacOs and Hyper-V on Windows and supports metadata for cloud-init.
It allows you to launch a fresh Ubuntu environment with a single command and it is also possible to simulate a small cloud deployment.

Installation

I’m going now to show you how to install multipass locally on my MacBook but you can also install the tool on Windows or on Linux.
You have 2 options to achieve this. brew (https://brew.sh/), the package manager or the mac installer.
As brew is already installed, let’s do it with brew.
(⎈ |docker-desktop:default)[email protected] K8S % brew install --cask multipass
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 1 formula.
==> Downloading https://github.com/CanonicalLtd/multipass/releases/download/v1.6.2/multipass-1.6.2+mac-Darwin.pkg
Already downloaded: /Users/sme/Library/Caches/Homebrew/downloads/64f65f71508526f4215f89bec1a12bbc130d408d2bd22f9460fc792fe5aa09f6--multipass-1.6.2+mac-Darwin.pkg
==> Installing Cask multipass
==> Running installer for multipass; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is multipass
installer: Installing at base path /
installer: The install was successful.
🍺 multipass was successfully installed!

Let’s check the Version
(⎈ |docker-desktop:default)[email protected] ~ % multipass version
multipass 1.6.2+mac

Environment setup

To provision and customize the virtual machines to simulate a small cloud deployment, I will use “cloud-init” from Canonical
Let’s create the 3 VMs.
((⎈ |docker-desktop:default)[email protected] K8S % curl https://raw.githubusercontent.com/tigera/ccol1/main/control-init.yaml | multipass launch -n control -m 2048M 20.04 --cloud-init -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6325 100 6325 0 0 11115 0 --:--:-- --:--:-- --:--:-- 11115
Launched: control
(⎈ |docker-desktop:default)[email protected] K8S % curl https://raw.githubusercontent.com/tigera/ccol1/main/node1-init.yaml | multipass launch -n node1 20.04 --cloud-init -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6481 100 6481 0 0 13789 0 --:--:-- --:--:-- --:--:-- 13760
Launched: node1
(⎈ |docker-desktop:default)[email protected] K8S % curl https://raw.githubusercontent.com/tigera/ccol1/main/node2-init.yaml | multipass launch -n node2 20.04 --cloud-init -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6481 100 6481 0 0 12487 0 --:--:-- --:--:-- --:--:-- 12463
Launched: node2

Depending on which platform you are, you may need to start the VMs after they have been launched.
On my desktop, they were all running.
(⎈ |docker-desktop:default)[email protected] K8S % multipass list
Name State IPv4 Image
control Running 198.19.0.1 Ubuntu 20.04 LTS
node1 Running 198.19.0.2 Ubuntu 20.04 LTS
node2 Running 198.19.0.3 Ubuntu 20.04 LTS

otherwise start them as following:
(⎈ |docker-desktop:default)[email protected] K8S % multipass start --all
To check and validate if the deployment was successful, log on the first VM and run
[email protected]:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
node1 NotReady 5m12s v1.19.3
node2 NotReady 6m33s v1.19.3
control NotReady master 3m12s v1.19.3

As you can notice above, the status is “NotReady” and this is because the CNI (Container Nerwork Interface) plugin is not installed.

Conclusion

That’s all you have to do to install Multipass VM manager and deploy Virtual Machines.
With this tool you can rapidly test your latest developments, so give this tool a chance. In a next blog, I will use this environment and show how to install “Calico”, one of the most famous CNI.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Saïd Mendi
Saïd Mendi

Senior Consultant