Lightweight Kubernetes on Raspberry Pi

  1. Set up the microSD card and install Raspbian Lite Image
  2. Configure SSH and WiFi
  3. Configure the Raspberry Pi
  4. Install K3S Server on the master
  5. Install K3S Agent on worker nodes
  6. Install the Kubernetes Dashboard for monitoring the cluster

Hardware Components needed

  1. Raspberry Pi x 3
  2. 16 GB microSD card x 3
  3. Raspberry compatible power supply x 3

Softwares needed

curl -sfL https://get.k3s.io | sh -
sudo systemctl status k3s
export K3S_URL="https://k3smaster:6443" export K3S_TOKEN="<<replace with your token>>"
curl -sfL https://get.k3s.io | sh -
kubectl get nodes rpimaster Ready master 33h v1.17.4+k3s1 
rpinode2 Ready <none> 28h v1.17.4+k3s1
rpinode1 Ready <none> 29h v1.17.4+k3s1
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
cat <<EOF | kubectl apply -f -
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kubernetes-dashboard
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kubernetes-dashboard
---
EOF
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
kubectl proxy --port=8081

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store