Ubuntu 22.04 k3s 在 LXC(无 LXD)上打开 /dev/kmsg:操作不允许

Ubuntu 22.04 k3s 在 LXC(无 LXD)上打开 /dev/kmsg:操作不允许

我正在尝试在 LXC(无 LXD)容器上安装 k3s。

我像这样创建容器,

lxc-create -t ubuntu -n master1 -- -r jammy

我的容器配置如下,

  linux.kernel_modules = ip_tables,ip6_tables,netlink_diag,nf_nat,overlay,br_netfilter

# Common configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf

# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/master1/rootfs
lxc.uts.name = master1
lxc.arch = amd64

# Network configuration
lxc.net.0.type = veth
#lxc.net.0.link = lxcbr0
lxc.net.0.script.up = /etc/lxc/ifup
lxc.net.0.script.down = /etc/lxc/ifdown
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:1a:47:7e
lxc.net.0.ipv4.address = 192.168.0.102/24
lxc.net.0.ipv4.gateway = 192.168.0.101

lxc.apparmor.profile = unconfined
lxc.cgroup.devices.allow =  a
lxc.cap.drop=
lxc.mount.auto =  "proc:rw sys:rw"
lxc.mount.entry = /dev/kmsg dev/kmsg none defaults,bind,create=file

我安装了 k3scurl -sfL https://get.k3s.io | sh -

我得到了

Apr  7 17:48:38 master1 k3s[125]: I0407 17:48:38.035333     125 kubelet.go:309] "Adding apiserver pod source"
Apr  7 17:48:38 master1 k3s[125]: I0407 17:48:38.035365     125 apiserver.go:42] "Waiting for node sync before watching apiserver pods"
Apr  7 17:48:38 master1 k3s[125]: Error: failed to run Kubelet: failed to create kubelet: open /dev/kmsg: operation not permitted
Apr  7 17:48:38 master1 k3s[125]: time="2024-04-07T17:48:38Z" level=error msg="kubelet exited: failed to run Kubelet: failed to create kubelet: open /dev/kmsg: operation not permitted"
Apr  7 17:48:38 master1 systemd[1]: k3s.service: Main process exited, code=exited, status=1/FAILURE
Apr  7 17:48:38 master1 systemd[1]: k3s.service: Failed with result 'exit-code'.
Apr  7 17:48:38 master1 systemd[1]: Failed to start Lightweight Kubernetes.

非常感谢您的帮助。

问候,j

相关内容