{"id":13631978,"url":"https://github.com/dsmith73/pi-cluster","last_synced_at":"2026-04-05T21:04:45.671Z","repository":{"id":215628522,"uuid":"274991280","full_name":"dsmith73/pi-cluster","owner":"dsmith73","description":"raspberry pi cluster to use with docker swarm and k3s","archived":false,"fork":false,"pushed_at":"2020-06-25T18:51:33.000Z","size":12,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T18:20:28.718Z","etag":null,"topics":["101101","ansible","docker","k3s","kubernetes","raspberry-pi","swarm"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dsmith73.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-06-25T18:47:37.000Z","updated_at":"2023-01-20T04:37:36.000Z","dependencies_parsed_at":"2024-01-05T14:57:29.425Z","dependency_job_id":null,"html_url":"https://github.com/dsmith73/pi-cluster","commit_stats":null,"previous_names":["dsmith73/pi-cluster"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dsmith73/pi-cluster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsmith73%2Fpi-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsmith73%2Fpi-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsmith73%2Fpi-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsmith73%2Fpi-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsmith73","download_url":"https://codeload.github.com/dsmith73/pi-cluster/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsmith73%2Fpi-cluster/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263791274,"owners_count":23512144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["101101","ansible","docker","k3s","kubernetes","raspberry-pi","swarm"],"created_at":"2024-08-01T22:02:46.918Z","updated_at":"2025-12-30T22:16:21.881Z","avatar_url":"https://github.com/dsmith73.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Building a Raspberry PI cluster  \r\n\r\n\u003eI wanted to have a small development environment that I could use to test out docker swarms and kubernetes in the k3s configuration. This would allow me to stop using Windows Subsystem for Linux (WSL) or VMs to run them, and let me use them for the management of the cluster.  \r\n\r\nI looked at several different raspberry pi images, weighted their pros and cons, and then finally settled on using `DietPi`, over a standard minimalist install, or the hypriot image. I felt that DietPi would give me most of the configurability of hypriot, while staying closer to the OOB configuration offered by Raspberry.\r\n\r\n---\r\n\r\n### Architecture:  \r\n**Hardware**  \r\n| Amount | Description |\r\n| ------ | ----------- |\r\n| 5 | Raspberry pi 3B+ | \r\n| 1 | switch | \r\n| 1 | VIXMINI wireless router  |\r\n| 1 | Ankr power supply  |\r\n\r\n**Software**  \r\n  - dietpi os  \r\n  - Etcher  \r\n  - Ansible  \r\n\r\n---\r\n\r\n### Issues \u0026 Fixes  \r\n**Issues**  \r\n  * Python apparently wasn't installed on the images that I used - so I made a script to handle that part before running the plays (as part of the playbook)  \r\n\r\n```sh\r\n#!/bin/bash\r\n# start_here.sh\r\n# don't forget to \"chmod +x start_here.sh\"  \r\n\r\nUSERNAME=root\r\nPASSWORD=\"XXXXXXXXXXXXXXXXXXX\"\r\nHOSTS=\"n99.ds\"\r\nSCRIPT=\"apt install python -y\"\r\n\r\nsshpass -p ${PASSWORD} ssh -o StrictHostKeyChecking=no -l ${USERNAME} ${HOSTNAME} \"${SCRIPT}\"\r\n```\r\n\r\n---\r\n\r\n### Templates  \r\n**To make things consistent, I templated the config**  \r\n  * Update the following files -  \r\n    * `Automation_Custom_PreScript.sh` with pre-network scripts and place in `/boot`   \r\n    * `Automation_Custom_Script.sh` with post-install scripts and place in `/boot`  \r\n      * any additional packages that I want installed or configurations that I want performed  \r\n    * `dietpi.txt` with desired settings and place in `/boot` - I changed the following -  \r\n      * AUTO_SETUP_LOCALE=en_US.UTF-8  \r\n      * AUTO_SETUP_KEYBOARD_LAYOUT=us  \r\n      * AUTO_SETUP_TIMEZONE=America/New_York  \r\n      * AUTO_SETUP_NET_ETHERNET_ENABLED=1  \r\n      * AUTO_SETUP_NET_WIFI_ENABLED=1  \r\n      * AUTO_SETUP_NET_USESTATIC=1  \r\n      * AUTO_SETUP_NET_STATIC_IP=10.11.0.99  \r\n      * AUTO_SETUP_NET_STATIC_MASK=255.255.255.0  \r\n      * AUTO_SETUP_NET_STATIC_GATEWAY=10.11.0.1  \r\n      * AUTO_SETUP_NET_STATIC_DNS=10.11.0.1 8.8.8.8  \r\n      * AUTO_SETUP_NET_HOSTNAME=n99  \r\n      * AUTO_SETUP_HEADLESS=1  \r\n      * AUTO_SETUP_AUTOMATED=1   \r\n      * AUTO_SETUP_GLOBAL_PASSWORD=XXXXXXX  \r\n      * CONFIG_NTP_MODE=3  \r\n      * CONFIG_WIFI_COUNTRY_CODE=US  \r\n    * `dietpi-wifi.txt` with desired settings and place in `/boot`   \r\n      * aWIFI_SSID[0]='WIFI SSID'  \r\n      * aWIFI_KEY[0]='WIFI PASSWORD'  \r\n  * Enable SSH  \r\n    * put an empty `ssh` file (no extension) in the `/boot` directory  \r\n\r\n---\r\n\r\n### Playbook Outline  \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gZzkoZmE6ZmEtY29kZSB2YWxpZGF0ZV9kaWV0cGlfdHh0KVxuIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRhcmsifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)  \r\n\r\n---  \r\n\r\n#### keys.yml\r\n\r\n```yml\r\nJOIN_K3S_CLUSTER     : \"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\r\nJOIN_DOCKER_SWARM    : \"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\r\n```\r\n\r\n---\r\n\r\n### Knowledge:  \r\n**Some of the resources that I used for this**  \r\n  - [Setup DietPi on Raspberry](https://pimylifeup.com/raspberry-pi-dietpi/)  \r\n  - [Cluster computing on the Raspberry Pi with Kubernetes](https://opensource.com/life/16/2/build-a-kubernetes-cloud-with-raspberry-pi)  \r\n  - [Kubernetes Raspberry Pi 3 cluster](https://github.com/Project31/ansible-kubernetes-openshift-pi3)  \r\n  - [SSL certs easy with k3s](https://opensource.com/article/20/3/ssl-letsencrypt-k3s?utm_campaign=intrel)  \r\n  - [Grafana Docker image](https://grafana.com/docs/grafana/latest/installation/docker/)  \r\n  - [BrewPi](https://wiki.brewpi.com/getting-started/raspberry-pi-docker-install)  \r\n\r\n---  \r\n\r\n|[#dsmith73](https://github.com/dsmith73)|\r\n| :---: |\r\n|![github.com/dsmith73](https://avatars1.githubusercontent.com/u/44279121?s=60\u0026u=7a933a33b51505f9d6435eeffae1c8156a47dc77\u0026v=4 \"github.com/dsmith73\")  |  \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsmith73%2Fpi-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsmith73%2Fpi-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsmith73%2Fpi-cluster/lists"}