Install with LXD

LXD is a manager for Linux-based containers (LXC), offering a user experience similar to virtual machines without the same overheads.

Using LXD to install MAAS into containers is a good choice for users who want to test MAAS, or who may want to continue leveraging an existing container architecture or policy.

Quick questions you may have:

Some networking traps

The managed lxdbr0 bridge – recommended below – automatically employs dnsmasq. If you name the LXD container “maas”, you can get into a condition where “maas” is being resolved by dnsmasq for the LXD managed bridge rather than maas DNS itself, where the full fqdn is maas.lxd rather than maas.maas. Check this post for details.

Also, you may have to broaden the default root user subuid mapping to include the snap_daemon user. See this post for details and instructions.

Install with LXD (20.04)

Installing LXD for use with MAAS is quite simple:

snap install lxd
lxd init

If you expect to use multiple networks in your MAAS container (for example, libvirt KVMs), you’ll want to take the following steps:

lxc profile copy default maas-profile
lxc profile device set maas-profile eth0 network lxdbr0

From here, you can launch your container and install MAAS in the normal way for your chosen version, adding the -p maas-profile only if you created a special profile for MAAS networking:

lxc launch --profile maas-profile ubuntu:20.04 bionic-maas
lxc exec bionic-maas bash

Then, proceed with a normal MAAS install on a container.

Install with LXD (16.04/18.04)

MAAS running with LXD has the following requirements:

  • a network bridge on the LXD host (e.g. lxdbr0)
  • LXD and ZFS
  • a container profile

Install LXD and ZFS

Begin by installing LXD and ZFS:

sudo apt install lxd zfsutils-linux
sudo modprobe zfs
sudo lxd init

The sudo lxd init command will trigger a series of configuration questions. Except in the case where the randomly chosen subnet may conflict with an existing one in your local environment, all questions can be answered with their default values.

The bridge network is configured via a second round of questions and is named lxdbr0 by default.

Create a LXC profile for MAAS

First create a container profile by making use of the ‘default’ profile:

lxc profile copy default maas-profile

Second, bind the network interface inside the container (eth0) to the bridge on the physical host (lxdbr0):

lxc profile device set maas-profile eth0 parent lxdbr0

Thirdly, the maas container profile needs to be edited to include a specific set of privileges. Enter the following to open the profile in your editor of choice:

lxc profile edit maas-profile

And replace the {} after config with the following (excluding config:):

config:
  raw.lxc: |-
    lxc.cgroup.devices.allow = c 10:237 rwm
    lxc.apparmor.profile = unconfined
    lxc.cgroup.devices.allow = b 7:* rwm
  security.privileged: "true"

The final step adds the 8 necessary loop devices to LXC:

for i in `seq 0 7`; do lxc profile device add maas-profile loop$i unix-block path=/dev/loop$i; done

When correctly configured, the above command outputs Device loop0 added to maas-profile for each loop device.

Launch and access the LXD container

Launch the LXD container:

lxc launch -p maas-profile ubuntu:18.04 bionic-maas

Once the container is running, it can be accessed with:

lxc exec bionic-maas bash

Install MAAS

In the container (or containers),install MAAS.


Last updated 2 months ago.