Pau*_*aul 0 raspberry-pi kubernetes k3s
我正在尝试安装并运行一个单节点轻量级 kubernetes 集群,以便在我的 Raspberry pi4(我发现了 k3s)上使用。然而,从我读过或看到的内容来看,我可能遗漏了一些东西,但还没有找到我遇到的确切问题的参考(安装后使用简单的 kubectl 命令进行测试):
\n$ kubectl get nodes\nError from server (ServiceUnavailable): the server is currently unable to handle the request\nRun Code Online (Sandbox Code Playgroud)\n我参考过的安装:
\n$ sudo k3s server\nINFO[2020-09-30T06:58:13.488363192+01:00] Starting k3s v1.18.9+k3s1 (630bebf9)\nINFO[2020-09-30T06:58:13.489450500+01:00] Cluster bootstrap already complete\nFATA[2020-09-30T06:58:13.535582640+01:00] starting kubernetes: preparing server: start cluster and https: listen tcp :6443: bind: address already in use\nRun Code Online (Sandbox Code Playgroud)\n\n\n根据较新的安装版本,假定不再需要这样做。
\n
因此,如果有人能够帮助我,或者指导我更好地调试和显示问题,以便我理解并解决问题。
\n安装反馈并未显示出现任何问题:
\n$ sudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 664" sh -\n[INFO] Finding release for channel stable\n[INFO] Using v1.18.9+k3s1 as release\n[INFO] Downloading hash https://github.com/rancher/k3s/releases/download/v1.18.9+k3s1/sha256sum-arm.txt\n[INFO] Downloading binary https://github.com/rancher/k3s/releases/download/v1.18.9+k3s1/k3s-armhf\n[INFO] Verifying binary download\n[INFO] Installing k3s to /usr/local/bin/k3s\n[INFO] Creating /usr/local/bin/kubectl symlink to k3s\n[INFO] Creating /usr/local/bin/crictl symlink to k3s\n[INFO] Creating /usr/local/bin/ctr symlink to k3s\n[INFO] Creating killall script /usr/local/bin/k3s-killall.sh\n[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh\n[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env\n[INFO] systemd: Creating service file /etc/systemd/system/k3s.service\n[INFO] systemd: Enabling k3s unit\nCreated symlink /etc/systemd/system/multi-user.target.wants/k3s.service \xe2\x86\x92 /etc/systemd/system/k3s.service.\n[INFO] systemd: Starting k3s\nRun Code Online (Sandbox Code Playgroud)\n之后,尝试命令:
\n$ k3s --version\nk3s version v1.18.9+k3s1 (630bebf9)\n$ kubectl version\nClient Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.9+k3s1", GitCommit:"630bebf94b9dce6b8cd3d402644ed023b3af8f90", GitTreeState:"clean", BuildDate:"2020-09-17T19:04:57Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/arm"}\nError from server (ServiceUnavailable): the server is currently unable to handle the request\n$ sudo kubectl get nodes\nError from server (ServiceUnavailable): the server is currently unable to handle the request\n$ sudo k3s kubectl get nodes\nThe connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?\nRun Code Online (Sandbox Code Playgroud)\n通过 htop 观察,k3s 服务器肯定发生了“某些事情”:
\n\n不确定设备上的 k3s 服务器 + 代理是否缺少任何内容,或者必须更改为主机:
\n127.0.0.1 localhost\n::1 localhost ip6-localhost ip6-loopback\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\n\n127.0.1.1 raspberrypi\nRun Code Online (Sandbox Code Playgroud)\n...不知道要进一步调试什么?
\n在了解更多安装过程后,通过观看此视频(k3s install on Pi4 - live walkthrough),我注意到 k3s 在 raspbian 上作为服务运行。
这意味着您能够:
# see all listed services, to find the name of the running k3s service
$ systemctl --type=service
# service name ironically being 'k3s', and being able to follow the logs for service
$ journalctl -u k3s -f
Run Code Online (Sandbox Code Playgroud)
但是,在“/boot/cmdline.txt”中查看,这些 cgroup 值位于文件中,但位于 endline 字符之后,这阻止了 k3s 服务从文件中充分读取。文件内容需为:
$ sudo cat /boot/cmdline.txt
console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cgroup_enable=1 cgroup_memory=1 cgroup_enable=memory
Run Code Online (Sandbox Code Playgroud)
完成后,我再次检查了journalctl的日志,并注意到其他明显的日志,涉及pod的容器等。主节点正在运行!:
$ sudo kubectl get nodes
NAME STATUS ROLES AGE VERSION
raspberrypi Ready master 3m52s v1.18.9+k3s1
Run Code Online (Sandbox Code Playgroud)
如果这仍然不起作用,我还看到了最近一篇关于同一问题的博客文章(由于 raspbian kernal 更新),其中还建议修复 ->帖子
| 归档时间: |
|
| 查看次数: |
4104 次 |
| 最近记录: |