This repo contains the code for my home automation system. It is based on k3s on a Raspberry Pi 5 using ArgoCD.
- k3s
- ArgoCD
- Prometheus
- Grafana
- Home Assistant
- Others?
- Raspberry Pi - I used a Raspberry Pi 5 with a 32GB SD card
Use the Raspberry Pi Imager to install Pi OS Lite.
SSH into the Raspberry Pi to disable swap and enable cgroups:
sudo swapoff -a
sudo sed -i '/^CONF_SWAPSIZE=/c\CONF_SWAPSIZE=0' /etc/dphys-swapfile
echo $(cat /boot/firmware/cmdline.txt) cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory | sudo tee /boot/firmware/cmdline.txt
sudo reboot
Then install k3s:
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --write-kubeconfig-mode 644" sh -
You can now get the kubeconfig file from the server using the following utility script on your local machine:
./scripts/merge-kubeconfig.sh %%MACHINE_NAME%%
Install ArgoCD using the utility script:
./scripts/install-argocd.sh
Install the app-of-apps:
kubectl apply -n argocd -f ./manifests/app-of-apps.yaml
Pi OS Lite comes with network preconfigured by the imaging tool. To edit network settings (e.g. Wifi) use:
sudo nmtui
To port-forward the ArgoCD server to your local machine:
k port-forward svc/argocd-server -n argocd 8080:80
To port-forward Grafana to your local machine:
k port-forward -n monitoring svc/kube-prometheus-stack-grafana 8081:80
To port-forward Home Assistant to your local machine:
k port-forward -n home-assistant svc/home-assistant 8082:8080