Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@janeczku
Created May 29, 2020 11:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save janeczku/4b2f4684b092635a325f51eb8d7a6f4f to your computer and use it in GitHub Desktop.
Save janeczku/4b2f4684b092635a325f51eb8d7a6f4f to your computer and use it in GitHub Desktop.
Configuration of k3s for single-node clusters to optimize performance on low power Raspberry Pi devices

Requirements

  • Raspberry Pi 3b+, CM3 or 4
  • 16GB+ SDHC card certified A1 or A2 grade to provide sufficient IO performance. Example: SanDisk Extreme microSDHC

Installation Steps

  1. Flash Ubuntu 18.04 LTS 64-bit Raspberry Pi disk image to the SD-card
  2. Either mount the boot partition on the same machine used to flash the image (Hint: sudo mkdir -p /mnt/rpi-boot && sudo mount -t vfat -o uid=root /dev/mmcblk0p1 /mnt/rpi-boot) or boot the Raspberry Pi once to apply the configuration changes below.
  3. Enable the missing cgroups by appending two arguments to /boot/firmware/nobtcmd.txt: cgroup_enable=memory cgroup_memory=1
  4. Reduce GPU shared memory by adding gpu_mem=16 in the applicable sections in /boot/firmware/config.txt
  5. Optional: Customize the Cloud-Init user-data file to configure SSH keys, passwords, install extra packages, etc.: /boot/firmware/user-data
  6. (Re-)Boot the device
  7. Then install k3s, disabling any features not necessary for single node edge cluster, using the following command:
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.17.5+k3s1 K3S_TOKEN=changeme sh -s - \
    --write-kubeconfig-mode 644  --disable traefik,metrics-server,local-storage \
    --disable-network-policy --disable-cloud-controller

Notes:

  • Available memory after installing k3s in server mode on RPI 3b+: 370MB
  • Available memory after installing Rancher Agent: 230MB
  • Available memory after installing Fleet Agent: 340MB

Prerequisites

Existing k3s cluster in cloud or datacenter with one or more master nodes

Steps

  1. Provision Raspberry Pi (see steps above)
  2. Install k3s and add to the cluster as worker node:
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.17.5+k3s1 K3S_TOKEN=changeme K3S_URL=https://xxx.xxx.222.211:6443 sh -s -

Notes:

  • Available memory after installing k3s in worker mode on RPI 3b+: 670MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment