Writing Ubuntu on MicroSD card
Let’s start by installing Ubuntu Server 20.04. For more detailed instructions you can follow the tutorial on how to install Ubuntu on Raspberry Pi.
First, insert the microSD card into your computer. Then you will need to install PRI imager by following one of these links or if you’re on ubuntu by running:
sudo snap install rpi-imager
Once this is done, start the Imager and open the “CHOOSE OS” menu:
Scroll down the menu click “Other general-purpose OS”:
Here you you can select Ubuntu and see a list of download options:
For this tutorial we recommend Ubuntu Server 20.04 64-bit download:
Select the image and open the “Choose storage” menu. Select the microSD card you have inserted:
And finally, click write and wait a few minutes.
Changing initial config files
Next, we need to configure the WiFi. With the microSD card still inserted in your laptop, open a file manager and locate the “writable” partition on the card. Find /etc/netplan/ And create the following network.yaml file replacing the values with your network credentials:
network:
version: 2
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
"YOUR_WIFI_NAME":
password: "YOUR_PASSWORD"
Save the file, copy it somewhere to use with other Raspberries.
The next step is to disable network configuration done by cloud init. Find /etc/cloud/cloud.d/ and create the following 99-network-config.yaml file:
network:
config: disabled
After this we need to edit the boot parameters for MicroK8s to work properly. Open cmdline.txt and add the following without changing the other default parameters:
cgroup_enable=memory cgroup_memory=1
Finally, extract the card from your laptop and put it in the Raspberry Pi.
After waiting a couple of minutes for the Raspberry to start, check your local network devices for its IP address. If no IPs are showing, you may need to login and reboot your Raspberry Pi with a USB keyboard and monitor connected to it, in order to check and change the network settings manually . If the network is not working, you can check /etc/netplan/network.yaml to see if all the information is correct. If not, edit the file and do:
sudo netplan apply
Now you should be able to connect to the Raspberry Pi. Repeat this process for the other nodes.