{"id":22189981,"url":"https://github.com/fgheysels/pi_k3s","last_synced_at":"2026-05-20T07:02:29.803Z","repository":{"id":153146767,"uuid":"593744720","full_name":"fgheysels/pi_k3s","owner":"fgheysels","description":"This repository contains some instructions on how to install a lightweight Kubernetes (k3s) on a Raspberry Pi","archived":false,"fork":false,"pushed_at":"2023-01-26T19:20:48.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T00:45:58.074Z","etag":null,"topics":["k3s","kubernetes","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":null,"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/fgheysels.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T18:39:59.000Z","updated_at":"2023-02-22T10:06:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f13989f-a412-4952-8a64-2b66b94e6834","html_url":"https://github.com/fgheysels/pi_k3s","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgheysels%2Fpi_k3s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgheysels%2Fpi_k3s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgheysels%2Fpi_k3s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgheysels%2Fpi_k3s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgheysels","download_url":"https://codeload.github.com/fgheysels/pi_k3s/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245346269,"owners_count":20600289,"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":["k3s","kubernetes","raspberry-pi"],"created_at":"2024-12-02T11:40:59.630Z","updated_at":"2026-05-20T07:02:29.797Z","avatar_url":"https://github.com/fgheysels.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nI have a Raspberry Pi lying around which is currently not being used anymore, so I figured I could as well use it to experiment a little bit with Kubernetes.\nTherefore I've decided to install k3s on it.\nIn this document, you can find the steps I took to install k3s on the Raspberry Pi.\n\n## Preparing the Raspberry PI\n\nI have prepared a SD card with the Raspberry Pi Imager.  All steps for this can be found on [Tom's hardware](https://www.tomshardware.com/how-to/set-up-raspberry-pi).\n\nOnce an OS has been installed on the Raspberry Pi, you should be able to connect to it via ssh:\n\n```\nssh \u003cusername\u003e@\u003cip\u003e\n```\n\nTo verify what OS the Pi is running, execute this command:\n\n```bash\ncat /etc/os-release\n```\n\n## Additional configuration\n\n### Assign a static IP \n\n\u003e Note: in hindsight, it is better to not do that and work with DHCP lease reservations to get a fixed IP.\n\nI've decided to give the Raspberry Pi a static IP.  That will make it easier to ssh to it.\n\nTo do this, add these lines to the `/etc/dhcpcd.conf` file:\n\n```\nhostname raspberrypi\n\ninterface eth0\nstatic ip_address=\u003cip\u003e/24\nstatic routers=\u003cyour-router-ip\u003e\nstatic domain_name_servers=\u003cyour-router-ip\u003e 8.8.8.8\n```\n\nEnable dhcpcd after this has been done:\n\n```\nsudo systemctl enable --now dhcpcd\n```\n\nIf dhcpcd is not installed, install it:\n\n```\nsudo apt update\nsudo apt install dhcpcd5\n```\n\nAfter you've done that, do not forget to add the IP you've choosen to the DHCP address reservation list in your router. \n\nThe changes only have effect after rebooting the Raspberry Pi.\n\n## Installing K3s\n\nSome prerequisites for installing k3s on a Raspberry Pi can be found [here](https://docs.k3s.io/advanced#raspberry-pi).\nIf you modify the `/boot/cmdline.txt` file, reboot before installing k3s.\n\nQuickstart guide for installing k3s can be found [here](https://docs.k3s.io/quick-start)\n\n## Install k3s\n\nExecute the command below; this will execute the k3s installation script that is available. \n\n```\ncurl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644\n```\n\nCustomizations via commandline arguments are possible (see documentation).\nNote that it is not recommended to use `docker` as the container runtime in k3s, as this can give issues, especially on ARM64 installations.\n\nWhen a warning is given during installation whic says something like this:\n\u003e  Failed to find memory cgroup, you may need to add \"cgroup_memory=1 cgroup_enable=memory\" to your linux cmdline (/boot/cmdline.txt on a Raspberry Pi)\n\nThe installation will probably fail.  These 2 flags must be added to the `cmdline.txt` file.  Afterwards, reboot the raspberry pi.\n\nOnce installation has finished, execute this command to verify if k3s is running\n\n```\nkubectl get node\n```\n\nWhen k3s is not running, verify the logs:\n```\njournalctl -u k3s.service\n```\n\n## Install pi-hole\n\nSee the `deployment.yaml` in the ´./pihole´ folder in this repo.  This deployment installs pihole on a single-node k3s (runs on 1 raspberry pi)\n\nThe deployment has a volume-mount to `/srv/pihole`.  This folder must exist before executing the deployment.\nCreate the folder and assign the correct owner:\n\n```\nsudo mkdir /srv/pihole\nchown -R 1000:1000 /srv/pihole\n```\n\nSince other services might also be running in the k3s cluster that have claimed port 80 already, I have specified a `NodePort` which exposes pihole-web on port `30080`. (See the `deployment.yaml`).\n\n\u003e Before installing the pihole deployment, make sure that the hostname is correctly set in the `nodeAffinity` property of the `persistent volume` definition.  (default value is `raspberrypi`)\n\nInstall it by executing the following command:\n\n```\nkubectl apply -f deployment.yaml -n pihole\n```\n\nVerify if pihole is used for name-resolving:\n```\nnslookup google.com\n```\nThe IP of pihole should be displayed as the DNS server.\n\n\nChange the password of the pihole webadmin tool by logging in into the container and set the password:\n\n```\nkubectl get pods -n pihole\nkubectl exec -n pihole -it \u003cpodname\u003e -- bash\n```\n\nNow, you have a prompt in the container.  Execute this command:\n\n```\npihole setpassword\n```\n\nNavigate to to see the dashboard.\n\n```\nhttp://\u003craspberry-ip\u003e:30080/admin\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgheysels%2Fpi_k3s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgheysels%2Fpi_k3s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgheysels%2Fpi_k3s/lists"}