Trying Ubuntu MAAS on Virtualbox

My end goal is to be able to run Kubernetes on my own PC. There easier ways to achieve that but the one that I need requires using MAAS since that is what we will use with our servers.

So, here are some random notes that might help you if you are a total newbie (like me) and are struggling with MAAS and Virtualbox.

First, is it even possible?

Yeah, no doubt. There aren’t many (if any) current guides regarding MAAS and Virtualbox. What I was able to find was at least a couple of years old and are outdated.

What do you need?

You will need one virtualbox for the MAAS server and at least one for a node.

The server should have 20GB of disk space, but you can probably use less if you only download images of a specific Ubuntu version.

The node can have 8GB of disk, maybe less. With 1 GB of RAM.

How do you configure Virtualbox?

The MAAS server should have 2 interfaces, one of type bridged adapter the other one a Host-only adapter.

The node should have only 1 interface and should be the same Host-only adapter as the server.

What to install on each Virtual Machine?

In my case I created a new Machine in Virtualbox and installed Ubuntu 16.04 LTS from scratch on it. I used the defaults from Ubuntu install except for the network config. I gave the second NIC the ip 10.1.1.100.

For the node you have to create a Machine with a disk but no operating system. Since we are booting from PXE we dont need to OS but we need that machine to be able to boot from the network and to do so first than from disk. You can find the boot order in the “System” tab of the Settings of the Machine.

Booting your Server

After booting the server virtual machine install maas on it and create a user.

sudo apt update
sudo apt install maas
sudo maas createadmin

You will have the option to add ssh keys to it. Do it.

Now you can login to http://<your.maas.ip:5240/MAAS/>.

Configuring DHCP

Sorry, I don’t remember exactly where but I had to add DHCP to one of the interfaces (the 10.1.1.100) via the MAAS admin. I think it was in the Subnet submenu.

Booting your node

MAAS does some discovering for us. You don’t need to register or add your machine to the MAAS server. It will add it itself when the machine boots from it.

Boot and wait. The server will eventually show up in the dashboard of the MAAS admin.

I had problems with this step. I was getting the error “Can not apply stage config, no datasource found! Likely bad things to come!”. There some old bugs that are related to that exact error message, but they were either fixed or people found solutions but never shared how they solved it.

I had to make Virtualbox save a video of the node’s boot process to find out that the node was trying to get a file from the MAAS server on the wrong interface, the one that I configured in virtualbox for access to the internet, not the one that is shared between server/node (the “Host-only adapter”).

The solution is to edit /etc/maas/rackd.conf and set:

maas_url: http://10.1.1.100:5240/MAAS

After doing this and booting it it worked. And by work I mean “it starts booting and then the virtual machine window suddenly closes”. That’s expected. It goes thru a boot process then it shuts down. But it happens so fast you might think something went wrong.

Setting the Power mode

After the first boot MAAS will discover the new node. You won’t be able to do anything else until you define the node’s Server Type. I set it to manual.

This means that for some operations you will need to manually start the virtual machine.

IIRC, you will have to do this at least twice. One for Commissioning and one for Acquiring. Plus everytime you need it on after shutting it down.

Auto enlisting problem

At some point I decided to add a server using its mac address. But then it wouldnt get commissioned. The fix was just to delete it and boot it again. MAAS found it by itself and everything worked fine.

Login to a node

If you manage to boot a node and you setup your ssh keys you should be able to ssh to the server and from there to the node (if you have ForwardAgent set) using the user ubuntu.