Follow the official raspberry pi docs to image RaspbianOS (32bit only as of the time of this writing) into your memory card.
If desired, before ejecting the memory card, follow the steps here to setup a headless raspberry pi. Summarized below (on OSX):
touch /Volumes/boot/ssh
- touch /Volumes/boot/wpa_supplicant.conf
- vim /Volumes/boot/wpa_supplicant.conf
- Paste:
country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="<NETWORK-NAME>" psk="<NETWORK-PASSWORD>" }
Congratulations You are now ready to eject the memory card, insert it into the raspberry pi and boot it up!
Follow the guide here to setup ssh with key. Steps are summarized below:
- On your client machine (that will connect to raspberry pi), run:
And copy the output
cat ~/.ssh/id_rsa.pub
- SSH into raspberry pi
default password is
raspberry
- Run:
install -d -m 700 ~/.ssh
- Run:
nano ~/.ssh/authorized_keys
- Paste the contents you copied from step 1
Follow the guide here to install k3s on your raspberry pi. Steps are summarized below:
- Run:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker pi su - pi
- Run:
sudo nano /boot/cmdline.txt
and typecgroup_enable=memory cgroup_memory=1
at the end of the line. - Reboot the raspberry pi
shutdown -r
- Run:
sudo curl -sfL https://get.k3s.io | sh -s - --docker
Congratulations You have successfully installed k8s on your raspberry pi
NOTE
If running on raspberry pi k3s, prefix all kubectl commands with sudo
-
Run:
kubectl apply -f https://raw.githubusercontent.com/EngHabu/libki-k8s/main/kustomize/k8s_generated.yaml kubectl wait --for=condition=available --all deployments --timeout=10m || ( echo >&2 "Timed out while waiting for the deployments to become ready"; exit 1 ) kubectl rollout status --all
-
Create admin user: a. Run:
kubectl get pods -n libki
And note the libki server's pod name b. Run:
kubectl exec -n libki <pod name> -- perl script/administration/create_user.pl -u admin -p password -s
-
Port forward the libki service to validate everything is fine:
kubectl port-forward -n libki service/libki 10443:443
Or if on RPI's k3s:
sudo k3s kubectl port-forward -n libki service/libki 10443:443 --address 0.0.0.0
-
Visit localhost or raspberry pi and login with
admin
andpassword
.NOTE
Make sure to change your password as soon as you login.
Congratulations
You have a running deployment of libki.
- Set up ingress
- Increase the number of replicas for the libki server
- Add kustomize overlays for beefier k8s deployments (more container resources... etc.)
- Setup a cluster of Raspberry PIs to ensure the k8s cluster high-availability.