MicroCloud is a solution from Canonical that orchestrates System Containers (LXC) and Virtual Machines (VMs) with Software Defined Networking (SDN) and Software Defined Storage (SDS) platforms.

Despite the name, it supports between 3 and 50 nodes on a single fleet of hosts. The name refers to its small footprint: it delivers a virtualisation platform with high availability and live migration in minutes, with minimal overhead (close to bare-metal performance).

The whole package is open source:

  • MicroCloud – orchestrator
  • LXD – high-availability computing
  • Ceph – distributed storage
  • OVN – virtual networking

Requirements / Recommendations:

  • 3 hosts (VM, LXC, or bare-metal)
  • 4 vCPUs + 4 GB of RAM per host
  • 2 network adapters per host
  • 1 system volume + 1 local volume + 1 distributed volume per host

INSTALLATION

Start all hosts and connect them to the same network segment via the first network interface. The second network interface must have no IP address assigned (disable DHCP).

MicroCloud and all of its components are Snap packages. Since Snap is the native package manager on Ubuntu, deploy as many hosts as needed with the latest Ubuntu LTS, then run the following commands on all of them.

sudo apt update
sudo apt upgrade -y
sudo snap install microcloud lxd microceph microovn

On one of the hosts, run the command that scans for eligible hosts to join the cluster.

sudo microcloud init

Follow the prompts and make the necessary adjustments for your environment.

It is recommended to limit the search scope for faster discovery (it uses multicast UDP packets via mDNS).

Select all that apply. There will be no prompt or confirmation on the other hosts.

Besides the system volume, allocate the secondary drive for host-local storage.

Allocate the third volume to Ceph (SDS).

Assign the secondary network adapter to OVN (SDN).

Enter the default gateway and the range of IPs not currently in use (reserved on the DHCP server).


VISUALISATION

sudo microcloud cluster list
sudo lxc cluster list
sudo microceph cluster list
sudo microovn cluster list
sudo lxc list
sudo lxc storage list
sudo lxc storage info local
sudo lxc storage info remote
sudo lxc network show default
sudo lxc network list


UPDATES

Note that snapd (Snap Daemon) automatically checks for new versions in the Snap Store and initiates updates.

Check the currently installed versions:

sudo snap list

In Snap, the refresh argument is equivalent to running update followed by upgrade in apt.

sudo snap refresh --list
sudo snap refresh lxd --cohort="+"
sudo snap refresh microceph --cohort="+"
sudo snap refresh microovn --cohort="+"
sudo snap refresh microcloud --cohort="+"

UTILISATION

Use the lxc command to manage containers and VMs (QEMU). MicroCloud handles the software-defined infrastructure (network and storage) transparently. See the LXC Cheat Sheet post [Link].

sudo lxc launch ubuntu:22.04 ct1 --storage remote
sudo lxc launch ubuntu:22.04 ct2 --storage local
sudo lxc launch ubuntu:22.04 vm1 --vm
sudo lxc list

Some commands are only relevant in a cluster:

sudo lxc mv ct1 --target micro2
sudo lxc cp ct1 --target micro3 ct1-copy

System Containers can be migrated live, with no interruption.

To remove a node from the cluster for maintenance or shutdown:

lxc cluster evacuate micro3
lxc cluster restore micro3

To permanently remove a node from the cluster:

lxc cluster remove micro3
lxc cluster remove --force micro3

To add a new node:

sudo microcloud add

BONUS

For a more cutting-edge experience, you may want to try the next release candidate (with KVM):

sudo apt update
sudo apt install qemu-kvm ovmf -y
kvm-ok && sudo reboot
sudo snap refresh lxd --channel=latest/edge
sudo snap install microceph --channel=latest/edge
sudo snap install microovn --channel=22.03/edge
sudo snap install microcloud --channel=latest/edge
sudo snap set lxd ui.enable=true
sudo snap set lxd criu.enable=true
sudo systemctl reload snap.lxd.daemon.service
sudo microcloud init
watch 'clear ; sudo microcloud cluster list ; sudo lxc cluster list ; sudo microceph cluster list ; sudo microovn cluster list ; sudo lxc list ; sudo lxc storage list ; sudo lxc network list'

Note: By April 2024, Canonical planned to release MicroCloud 2.0 alongside Ubuntu 24.04 LTS on its 20th anniversary. If that has already happened, some of the commands above may be outdated.