A lightweight DevOps platform for home servers using Raspberry Pi and Kubernetes. This platform enables easy deployment, scaling, and management of containerized applications on low-cost hardware. It is ideal for learning Kubernetes, automating home projects, or running self-hosted services with minimal resources.
- Raspberry Pi 4 (recommended 4GB or 8GB RAM)
- Raspberry Pi OS (64-bit recommended for better performance)
- MicroSD card (32GB or larger recommended)
- Power supply (5V/3A recommended for Pi 4)
- Network connection (Ethernet or WiFi)
- Minimum: 2GB RAM, 16GB storage
- Recommended: 4GB+ RAM, 32GB+ storage
- OS: Raspberry Pi OS 64-bit (Bullseye or newer)
First, ensure your Raspberry Pi is up to date:
sudo apt update && sudo apt upgrade -y
sudo apt install git curl wget -y
K3s requires cgroups to be enabled. Run the setup script:
chmod +x Scripts/setup_cgroups.sh
sudo ./Scripts/setup_cgroups.sh
Note: This script modifies /boot/firmware/cmdline.txt
to enable memory cgroups. A reboot is required after this step.
sudo reboot
After rebooting, install K3s:
curl -sfL https://get.k3s.io | sh -
Wait for K3s to start (usually takes 1-2 minutes), then verify installation:
sudo k3s kubectl get nodes
Set up kubectl to work with your user account:
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
To make this permanent, add to your shell profile:
echo 'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> ~/.bashrc
# Or for zsh:
echo 'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> ~/.zshrc
Create the ArgoCD namespace and install it:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Wait for all pods to be ready:
kubectl get pods -n argocd
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
Get the NodePort:
kubectl get svc argocd-server -n argocd
Access ArgoCD at: https://<YOUR_PI_IP>:<NODEPORT>
kubectl port-forward svc/argocd-server -n argocd 8080:443
Access ArgoCD at: https://localhost:8080
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
Default username: admin
curl -sSL -o argocd-linux-arm64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-arm64
sudo install -m 555 argocd-linux-arm64 /usr/local/bin/argocd
rm argocd-linux-arm64
Login via CLI:
argocd login <YOUR_PI_IP>:<NODEPORT>
argocd repo add https://charts.bitnami.com/bitnami --type helm --name bitnami
sudo apt install zsh -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# Syntax highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Completions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
Edit ~/.zshrc
and add plugins:
plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-completions)
Error: Failed to find memory cgroup: You may need to add "cgroup_memory=1 cgroup_enable=memory"
Solution:
- Ensure you ran the cgroups setup script
- Reboot the system:
sudo reboot
- Verify cgroups are enabled:
cat /boot/firmware/cmdline.txt
Check logs:
sudo journalctl -u k3s -f
Common fixes:
- Ensure enough disk space:
df -h
- Check memory:
free -h
- Verify network connectivity
Check pod status:
kubectl get pods -n argocd
kubectl describe pods -n argocd
Common solutions:
- Wait longer (first startup can take 5-10 minutes)
- Check resource usage:
kubectl top nodes
- Restart ArgoCD:
kubectl delete pods -n argocd --all
If you want to access the Traefik dashboard:
- Edit the Traefik configuration:
sudo nano /var/lib/rancher/k3s/server/manifests/traefik.yaml
- Add dashboard configuration:
api:
dashboard: true
insecure: false
additionalArguments:
- "--api.dashboard=true"
- "--api=true"
- "--entrypoints.websecure.http.tls=true"
- Create an IngressRoute for the dashboard:
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard
namespace: kube-system
spec:
entryPoints:
- web
routes:
- match: PathPrefix(`/dashboard`) || PathPrefix(`/api`)
kind: Rule
services:
- name: api@internal
kind: TraefikService
- Access the dashboard:
curl http://<YOUR_PI_IP>:8080/dashboard/
- Deploy your first application using ArgoCD
- Set up monitoring with Prometheus and Grafana
- Configure persistent storage for your applications
- Set up backups for your cluster configuration
- Explore the ecosystem of Kubernetes applications
- Change default passwords
- Use HTTPS for all web interfaces
- Regularly update your system and applications
- Consider using a firewall
- Keep your cluster behind a router with NAT
For issues and questions:
- Check the K3s documentation
- Visit the ArgoCD documentation
- Review Raspberry Pi documentation
This project is licensed under the MIT License - see the LICENSE file for details.