Experience with MaaS installation.

Abstract
This post is about setting up MaaS on virtual machines, setting up basic environment for MaaS with 3 real machines, installing MaaS on the basic node environment with 3 machines.

Installing MaaS on Virtual Machine

The virtual environment is the same Ubuntu KVM installation as in the post Experience with Ubuntu/Openstack(neutron) installation. After you have KVM installed please watch through (Part 1-4) of these awesome videos to configure MaaS on your vms:







After following these videos you should have MaaS running successfully on your virtual machines.


Setting up basic environment for MaaS with 3 real machines

Prerequisites
Three comodity PCs with hardware requirements: 1-2 CPU, RAM 4 GB, HDD 500GB (that is for each PC); one of these 3 PCs should have 2 NICs. Also we need 4 Ethernet cables, 1 network switch. Also make sure that in the BIOS settings of your worker nodes you have parameter On Board LAN ROM: ENABLED, that is needed for booting up machines remotely via PXE boot. Otherwise if it is disabled you will not be able to wake up your machines.
So we should build following network architecture:



After we setup architecture (connected our PCs with cables and switch) we should install Ubuntu server 14.04.1 version on each machine plus controller node should have some GUI interface. The best one would be lubuntu-desktop-minimal. After Ubuntu system is installed on each machine we should configure network interfaces on these machines. 
Configure two interfaces for the controller node. One is eth0 usually goes to the internet it will receive IP address from DHCP server and eth1 will be a default gateway(router) for a local subnet, so give this interface an IP address from a network subnet(worker nodes) like (ex.:192.168.10.0/24).

Example of /etc/network/interfaces on a controller node:
# The loopback network interface
auto lo
iface lo inet loopback
pre-up iptables-restore < /etc/iptables.rules

# The external WAN interface (eth0)
auto eth0
iface eth0 inet dhcp

# The internal LAN interface (eth1)
auto eth1
iface eth1 inet static
    address 192.168.10.1    
    netmask 255.255.255.0

In the interfaces file everything seems to be clear except for the line (highlighted by the green color). I will give an explanation about it later. Next thing which we should do is to setup NAT on the controller node so that packets can be correctly routed to our subnet machines via our MaaS controller, which will act as a gateway:
sudo iptables -A FORWARD -o eth0 -i eth1 -s 192.168.10.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


And to activate iptables just do:
sudo iptables-restore < /etc/iptables.rules

Also add the pre-up iptables-restore < /etc/iptables.rules  line after iface lo inet loopback, which was mention at the top, to the /etc/network/interfaces file so that on each system boot iptables configuration will be loaded.This is triggered before the interface is up. Also enable IP forwarding:
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

Next setup a DHCP/DNS server:
sudo aptitude install dnsmasq
sudo /etc/init.d/dnsmasq stop








Then edit /etc/dnsmasq.conf by adding these lines:
interface=eth1
dhcp-range=192.168.10.2,192.168.10.254,infinite

After that reboot your contoller node then reboot your worker nodes. They will receive IP addresses from DHCP server of the controller node. And for the worker nodes make default gateway as the local net address of a controller node (eth1 ip address). After that check that each machine can ping one another. Then please check that all machines in our architecture have an internet access. So, just ping 8.8.8.8. If everything pings then you have set up everything correctly.


Installing MaaS on the basic node environment with 3 nodes.

Before we start the installation I would like to say that it will be almost identical to the installation mentioned above for the virtual machines. But there will be some tricks which you should know. So, lets start. Login to your controller node and open terminal. First thing which we have to do is to add repo from maas-maintainers because it has some extra packages which will make your maas installation and usage much easier. 
So first of all we should tell the system to pull down the latest list of software from each archive it knows about, including the PPA we are just going to add. Run the following commands in terminal:
sudo add-apt-repository ppa:maas-maintainers/stable
sudo apt-get update

After that install maas:
sudo apt-get install maas maas-dhcp maas-dns

Next thing which we should do is to configure etherwake to make PXE boot via ethernet device name: eth1. On the controller node in /etc/maas/templates/power/etherwake replace this line:
/usr/sbin/etherwake $mac_address

with this:
sudo /usr/sbin/etherwake -i eth1 $mac_address

Warning: Make sure that if you have two NICs you can have some difficulties setting up PXE boot on your controller or worker node. After etherwake can wakeup your nodes you can add it to your maas environment the same way as it is in videos above. You should choose WakeOnLAN option for your nodes. Also in the BIOS settings of each worker node setup BOOT priority (booting from the LAN should be first -> WAKEONLAN should be enabled in BIOS. How to do that please consult the google) because we are going to boot our machines via ethernet cable - PXE boot. Next thing which you should do is to find out your workers node MAC addresses because you need it to power on your nodes. After that when you added your nodes to a MaaS you can follow the standard procedure, like in the video and you will have working nodes with Ubuntu installed on it. By the end of installation you will have a small MaaS cluster. Try to ping each machine and check again access to the internet from each node. In case you want to know how to shut down machines please refer to the following post: MaaS - wakeonlan/etherwake manual shutdown.

So, that's pretty much everything for MaaS installation. For more technical information read Installing MaaS.

Comments

Popular Posts