The old laptop sat in the closet, gathering dust alongside forgotten winter coats and boxes of holiday decorations. Once a faithful companion through college assignments and late-night Netflix binges, it had been replaced by newer, shinier models. But what if this neglected machine could have a second life — not as a slow, frustrating browsing device, but as a crucial component in a cutting-edge cloud infrastructure?
This is the story of resurrection through technology. This is how your forgotten hardware becomes relevant again in the world of modern computing.
In the world of cloud computing and Kubernetes orchestration, it’s easy to assume that high availability and persistent storage setups require costly hardware and extensive resources. However, that old laptop gathering dust in your closet can be transformed into a powerful extra worker node for your Kubernetes cluster. In this guide, we’ll walk through expanding your existing setup with a Raspberry Pi as the control plane, installing distributed persistent storage using Longhorn, setting up monitoring with Prometheus and Grafana, and utilizing Lens for cluster observability.
Before diving into the technical configurations, ensure that you have a Raspberry Pi ready to serve as your control plane. Then, retrieve that forgotten laptop from its resting place and prepare it for its new purpose.
After installing the distribution, update the package lists and installed packages:
1
2
sudo apt update
sudo apt upgrade
In my previous post I’ve covered how to server Kuberentes on a Raspberry Pi using k3s. You can check it out here. Now we have to ensure that your Raspberry Pi exclusively acts as a control plane node by preventing pod scheduling on it.
SSH into your Raspberry Pi and add a taint:
1
kubectl taint nodes <control-plane-node> node-role.kubernetes.io/control-plane:NoSchedule
Extract the Node Token:
1
sudo cat /var/lib/rancher/k3s/server/node-token
Make sure to copy this token as it will be needed to join your worker node.
SSH into your Ubuntu Server (the old laptop) and run the following command to join the cluster:
1
curl -sfL https://get.k3s.io | K3S_URL=https://<control-plane-ip>:6443 K3S_TOKEN=your_token_here sh -
Replace <control-plane-ip>
with the actual IP address of your Raspberry Pi and your_token_here
with the token you copied earlier.
With the Raspberry Pi set as a control plane and your old laptop as a worker node, it’s time to install Longhorn for distributed persistent storage.
Update the kubeconfig file:
1
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
Install Longhorn using kubectl:
1
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.8.0/deploy/longhorn.yaml
Monitor the progress of the Longhorn installation:
1
kubectl get pods -n longhorn-system --watch
Monitoring the performance of your Kubernetes cluster is crucial, especially when you have multiple nodes.
Ensure Helm is installed: If you don’t have it yet, follow the installation guide.
Install Prometheus and Grafana:
1
2
3
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack
To easily manage and visualize your Kubernetes cluster, you can use Lens.
Stop the k3s server:
1
sudo systemctl stop k3s
Backup and delete existing TLS certificates:
1
2
sudo cp -r /var/lib/rancher/k3s/server/tls /var/lib/rancher/k3s/server/tls.bak
sudo rm -f /var/lib/rancher/k3s/server/tls/server-*
Edit or create /etc/rancher/k3s/config.yaml
:
1
2
tls-san:
- "pi.local"
Restart the k3s server:
1
sudo systemctl start k3s
Verify that the hostname is contained in the SANs:
1
openssl x509 -in /var/lib/rancher/k3s/server/tls/serving-kube-apiserver.crt -text -noout | grep "DNS:"
1
cat ~/.kube/config
Update cluster.server
in the kubeconfig to point to the configured hostname (e.g., https://pi.local:6443
).
To ensure your setup works, create a persistent volume claim:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: longhorn-test-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- name: test-pod
image: nginx:stable-alpine
volumeMounts:
- mountPath: /data
name: longhorn-vol
volumes:
- name: longhorn-vol
persistentVolumeClaim:
claimName: longhorn-test-pvc
Once the pod is running, add a file to the persistent storage:
1
2
kubectl exec -it test-pod -- sh -c "echo 'It works.' > /data/test.txt"
kubectl exec -it test-pod -- cat /data/test.txt
Your once-neglected laptop has now been reborn with a new purpose. By following these steps, you’ve successfully expanded your Kubernetes cluster using an old laptop as a worker node, implemented distributed persistent storage with Longhorn, and established monitoring capabilities using Prometheus and Grafana, all while leveraging Lens for observability.
This project not only breathes new life into unused hardware but also provides invaluable experience in managing a Kubernetes cluster. That dusty old laptop didn’t just find a new purpose — it became an integral part of a modern, cloud-native infrastructure. So, rescue that laptop from your closet, and let your Kubernetes journey continue!
We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.