k3s
Requirements
Disable swap
When installing Kubernetes on Linux, it’s recommended to disable swap because of how Kubernetes manages resources.
- Memory Management: Kubernetes efficiently manages and allocates resources, including memory. Allowing an operating system to swap can interrupt Kubernetes’ memory management process.
- Performance Issues: Swapping can lead to performance degradation. When Kubernetes needs to access something that has been swapped to disk, it must wait for it to be loaded back into memory, causing delays.
- Predictability: Disabling swap helps ensure predictable performance, as it removes the chance of the system swapping out Kubernetes’ processes.
- Kubernetes Design: Kubernetes is designed to work with no swapping activity. It assumes that applications are memory-resident, which means it expects them to stay in memory all the time.
Cgroup configuration
If a FATA[0000] failed to find memory cgroup (v2) error surfaces during the installation of k3s, it is likely because the Pi OS lacks the required cgroup configuration. Below are the steps needed to resolve this issue:
| nano /boot/firmware/cmdline.txt
|
| cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
|
Install K3S
https://k3s.io/
| curl -sfL https://get.k3s.io | sh -
|
| /usr/local/bin/k3s-uninstall.sh
|
Check for Ready node, takes ~30 seconds
| sudo k3s kubectl get node
|
Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
| cat /etc/rancher/k3s/k3s.yaml
|
Links