-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrasp-install.sh
executable file
·32 lines (27 loc) · 1.2 KB
/
rasp-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# append this string to /boot/firmware/cmdline.txt for microk8s to work
if ! grep -q "cgroup_enable=memory cgroup_memory=1" /boot/firmware/cmdline.txt; then
sudo sed -i '$ s/$/ cgroup_enable=memory cgroup_memory=1/' /boot/firmware/cmdline.txt
fi
# install microk8s
sudo apt update && sudo apt upgrade -y && sudo apt install snapd -y &&
sudo snap install microk8s --classic --channel=1.27/stable &&
sleep 10
sudo usermod -a -G microk8s $USER &&
sudo chown -f -R $USER ~/.kube &&
newgrp microk8s &&
# need to test if adding to path is needed maybe just reboot or restart/source shell
export PATH=$PATH:/snap/bin
if ! grep -q "PATH=$PATH:/snap/bin" ~/.bashrc; then
echo "PATH=$PATH:/snap/bin" >> ~/.bashrc
fi
source ~/.bashrc
# add/repair dns
sudo apt-get install systemd-resolved -y &&
sudo systemctl restart systemd-resolved &&
sleep 20 # allow things to settle
echo "Install script finished"
echo "Add a hostname of this node: " $(hostname) " and IPv4: " $(hostname -I)" to /etc/hosts on head node!"
echo "Then run:< microk8s.add-node > on head node, and connect this node to cluster"
microk8s version || echo "Please reboot rpi first and afterwards run: microk8s enable dns" && exit 1
microk8s enable dns