Skip to content

Instantly share code, notes, and snippets.

@htdangkhoa
Created April 24, 2022 19:26
Show Gist options
  • Save htdangkhoa/78d5f8c28963f0656d996d471de0290e to your computer and use it in GitHub Desktop.
Save htdangkhoa/78d5f8c28963f0656d996d471de0290e to your computer and use it in GitHub Desktop.
Setup Raspberry Pi cluster using NodeJS, Docker & K3S
# update apt
sudo apt update -y
# install git
sudo apt install -y git
# install NodeJS
curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt install -y nodejs
# install yarn
sudo npm install -g yarn
# install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker pi
# install Docker Compose
sudo apt-get install -y libffi-dev libssl-dev
sudo apt install -y python3-dev
sudo apt-get install -y python3 python3-pip
sudo pip3 install docker-compose
# set static wlan0 IP: https://linuxhint.com/raspberry_pi_static_ip_setup/
sudo nano /etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.0.31/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8
# install k3s
sudo nano /boot/cmdline.txt # add cgroup_memory=1 cgroup_enable=memory
# on server node
curl -sfL https://get.k3s.io | sh -
# on worker node
sudo cat /var/lib/rancher/k3s/server/node-token # run this command on server node and copy it
curl -sfL https://get.k3s.io | K3S_URL=<https://myserver:6443> K3S_TOKEN=<token> sh -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment