Skip to content

Instantly share code, notes, and snippets.

@imusmanmalik
Created March 9, 2023 20:28
Show Gist options
  • Save imusmanmalik/8c035e363f67f6a2a6c8dc55149abeab to your computer and use it in GitHub Desktop.
Save imusmanmalik/8c035e363f67f6a2a6c8dc55149abeab to your computer and use it in GitHub Desktop.
Installing Canonical MicroCloud

Installing Canonical MicroCloud

Pre-requisites

sudo apt update
sudo apt install -y openvswitch-switch ovn-common

LXD

Install

Ubuntu will have an outdated version of LXD pre-installed, so we need to make sure we have the most current version.

sudo snap refresh lxd

Storage

sudo snap install microceph

TODO: Discuss the importance of using ntp to avoid clock skews.*

Hacks

The current version of LXD is picky about keyring location; however, this is expected to change in the future.

sudo ln -s ceph.keyring /var/snap/microceph/current/conf/ceph.client.admin.keyring

Configure

To keep LXD happy, you'll need to enable pool deletion:

sudo microceph.ceph config set mon mon_allow_pool_delete true

Networking

You should use OVN networking because it allows you to create isolated VPCs that behave like you're used to.

Install

Disable the default openvswitch services:

sudo systemctl stop openvswitch-switch.service ovs-vswitchd.service ovsdb-server.service
sudo systemctl disable openvswitch-switch.service ovs-vswitchd.service ovsdb-server.service

Install the snap package; as there isn't a stable microovn release yet, we must utilize Edge here.

sudo snap install --edge --devmode microovn

Hacks

Finally, a number of simple hacks were made to allow LXD and microovn to communicate:

sudo mkdir -p /var/run/openvswitch
sudo sudo ln -s /var/snap/microovn/common/run/switch/db.sock /var/run/openvswitch/db.sock

Configure

Create a Bridge Interface on Each Node

for t in $(lxc cluster ls -f json | jq -r '.[].server_name'); do
    lxc network create br0 --type=bridge --target=$t
done

lxc network create br0 --type=bridge

Create the OVN Uplink Network

for t in $(lxc cluster ls -f json | jq -r '.[].server_name'); do
    lxc network create uplink --type=physical parent=br0 --target=$t
done

lxc network create uplink --type=physical \
   ipv4.ovn.ranges=<IP_range> \
   ipv6.ovn.ranges=<IP_range> \
   ipv4.gateway=<gateway> \
   ipv6.gateway=<gateway> \
   dns.nameservers=<name_server>

Create a Private VPC

parent_network=uplink
lxc network create ovntest --type=ovn network=$parent_network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment