https://github.com/0bu/rpi-k3s-cluster
k3s cluster for Raspberry Pi, installation and configuration
https://github.com/0bu/rpi-k3s-cluster
adguard argocd deconz grafana home-assistant homebridge influxdb k3s k8s metallb mosquitto prometheus raspberry-pi sealed-secrets telegraf
Last synced: 2 months ago
JSON representation
k3s cluster for Raspberry Pi, installation and configuration
- Host: GitHub
- URL: https://github.com/0bu/rpi-k3s-cluster
- Owner: 0Bu
- Created: 2021-05-05T10:56:51.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-26T20:17:39.000Z (about 2 years ago)
- Last Synced: 2024-04-28T03:58:55.538Z (about 2 years ago)
- Topics: adguard, argocd, deconz, grafana, home-assistant, homebridge, influxdb, k3s, k8s, metallb, mosquitto, prometheus, raspberry-pi, sealed-secrets, telegraf
- Homepage:
- Size: 682 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installing [k3s](https://k3s.io) on [Raspberry Pi OS](https://www.raspberrypi.com/software/operating-systems/)
### Enable cgroups
- append `cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory` to `/boot/firmware/cmdline.txt`
- *optional*: append `arm_64bit=1` to `/boot/config.txt` under `[all]` on 32-bit Raspberry Pi OS ([arm_64bit](https://www.raspberrypi.com/documentation/computers/config_txt.html#arm_64bit))
## [NFS](https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-20-04-de)
#### Client
```
sudo apt update
sudo apt install nfs-common
```
#### Server
```
sudo apt update
sudo apt install nfs-kernel-server
sudo mkdir /nfs
sudo chown -R nobody:nogroup /nfs
```
#### NFS export config
```
sudo vim /etc/exports
/nfs 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
```
```
sudo systemctl restart nfs-kernel-server
```
#### NFS client mount
```
sudo mkdir /mnt/nfs
sudo mount :/nfs /mnt/nfs
```
## Dual stack installation
k3s docs:
#### *Optional*: Router Advertisement Daemon
```
sudo apt install radvd
```
#### [radvd configuration](https://linux.die.net/man/5/radvd.conf)
`sudo vim /etc/radvd.conf`
```
interface eth0 {
AdvSendAdvert on;
prefix fd7c:3b4a:5f1d::/64 {};
};
```
### Add static IPv6 ULA
check the link `ip link` and create
`sudo vim /etc/systemd/network/10-eth0-static-ipv6.network`
```
[Match]
Name=eth0
[Network]
IPv6AcceptRA=yes
Address=fd7c:3b4a:5f1d::5a/64
```
### Enable systemd-network
```
sudo systemctl enable systemd-networkd
sudo systemctl restart systemd-networkd
```
## Master installation
```
sudo mkdir -p /etc/rancher/k3s
sudo vim /etc/rancher/k3s/config.yaml
```
```
write-kubeconfig-mode: "644"
disable:
- servicelb
node-ip: "192.168.1.5,fd7c:3b4a:5f1d::5a"
cluster-cidr: "10.42.0.0/16,fd00:10:42::/56"
service-cidr: "10.43.0.0/16,fd00:10:43::/112"
flannel-ipv6-masq: true
```
```
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.35.0+k3s3" sh -
```
### Node installation
Get master token
`sudo cat /var/lib/rancher/k3s/server/node-token`
```
sudo mkdir -p /etc/rancher/k3s
sudo vim /etc/rancher/k3s/config.yaml
```
```
server: "https://192.168.1.5:6443"
token: "TOKEN"
write-kubeconfig-mode: "644"
node-ip: "192.168.1.5,fd7c:3b4a:5f1d::5a"
```
```
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.35.0+k3s3" sh -
```
## High availability cluster installation
k3s docs:
```
sudo mkdir -p /etc/rancher/k3s
sudo vim /etc/rancher/k3s/config.yaml
```
```
cluster-init: true
token: "TOKEN"
write-kubeconfig-mode: "644"
disable:
- servicelb
node-ip: "192.168.1.5,fd7c:3b4a:5f1d::5a"
cluster-cidr: "10.42.0.0/16,fd00:10:42::/56"
service-cidr: "10.43.0.0/16,fd00:10:43::/112"
flannel-ipv6-masq: true
```
```
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.35.0+k3s3" sh -
```
### High availability node installation
```
sudo mkdir -p /etc/rancher/k3s
sudo vim /etc/rancher/k3s/config.yaml
```
```
server: https://192.168.1.5:6443
token: "TOKEN"
write-kubeconfig-mode: "644"
disable:
- servicelb
node-ip: "192.168.1.15,fd7c:3b4a:5f1d::5b"
cluster-cidr: "10.42.0.0/16,fd00:10:42::/56"
service-cidr: "10.43.0.0/16,fd00:10:43::/112"
flannel-ipv6-masq: true
```
```
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.35.0+k3s3" sh -
```
## Single stack installation
k3s docs:
```
export K3S_KUBECONFIG_MODE="644"
export INSTALL_K3S_VERSION="v1.35.0+k3s3"
export INSTALL_K3S_EXEC="--disable servicelb"
curl -sfL https://get.k3s.io | sh -
```
### Node installation
On master
```
sudo cat /var/lib/rancher/k3s/server/node-token
```
```
export K3S_KUBECONFIG_MODE="644"
export INSTALL_K3S_VERSION="v1.35.0+k3s3"
export K3S_URL="https://192.168.1.5:6443"
export K3S_TOKEN="TOKEN"
curl -sfL https://get.k3s.io | sh -
```
### [Helm](https://helm.sh) installation
```
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
```
#### Helm configuration
```
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
```
or
```
mkdir -p ~/.kube
kubectl config view --raw > ~/.kube/config
sudo chmod go-r ~/.kube/config
```
### [k9s](https://github.com/derailed/k9s) installation
```
curl -sLO "https://github.com/derailed/k9s/releases/download/v0.50.18/k9s_linux_arm.deb"
sudo dpkg -i k9s_linux_arm.deb
rm k9s_linux_arm.deb
```