0
0

ラズパイ5にKubernetes(k3s)環境を構築する

Last updated at Posted at 2024-07-11

こちらも参考にさせていただきました。

事前準備

「Raspberry Pi OS は Debian ベースであり、既知の iptables バグの影響を受ける可能性があります。既知の問題を参照してください。」とありますが、対象のバージョン(Iptables バージョン 1.8.0 ~ 1.8.4)ではありませんでした。

$ sudo iptables -V
iptables v1.8.9 (nf_tables)

cgroupsサービスを開始

$ sudo cat /boot/cmdline.txt 
DO NOT EDIT THIS FILE

The file you are looking for has moved to /boot/firmware/cmdline.txt
$ sudo nano /boot/firmware/cmdline.txt
cgroup_memory=1 cgroup_enable=memory を追記
$ sudo reboot now

とりあえず有効になってるっぽい?
https://blog.sakashita.dev/2020/07/cgroupsmd.html

$ cat /proc/cgroups
#subsys_name    hierarchy       num_cgroups     enabled
cpuset  0       112     1
cpu     0       112     1
cpuacct 0       112     1
blkio   0       112     1
memory  0       112     1
devices 0       112     1
freezer 0       112     1
net_cls 0       112     1
perf_event      0       112     1
net_prio        0       112     1
pids    0       112     1

linux-modules-extra-raspi

これはRaspbianではいらないということでいいのかな?
「Ubuntu 21.10 以降、Raspberry Pi 上の vxlan サポートは別のカーネル モジュールに移動されました。
sudo apt install linux-modules-extra-raspi」
ということでスキップ

swap無効化

$ sudo swapoff --all
$ sudo systemctl stop dphys-swapfile.service
$ sudo systemctl disable dphys-swapfile.service

インストール

$ curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644
$ kubectl get nodes
NAME        STATUS   ROLES                  AGE   VERSION
raspberrypi   Ready    control-plane,master   7s    v1.29.6+k3s2
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0