PI4 k3s安装服务器当前无法处理该请求 [英] PI4 k3s install server currently unable to handle the request
问题描述
我正在尝试安装并运行一个单节点轻量级kubernetes集群,以便在我发现了k3的Raspberry pi4上使用它.但是,从我已经阅读或看到的内容来看,我可能丢失了一些东西,但是没有找到我要解决的确切问题的参考(安装后使用简单的kubectl命令进行测试):
I'm trying to install and run a single-node lightweight kubernetes cluster, to play around with on my Raspberry pi4, of which I found k3s. However, from what I've read or seen, I'm probably missing something, but haven't found reference to the exact problem I'm getting (testing with simple kubectl command after installation):
$ kubectl get nodes
Error from server (ServiceUnavailable): the server is currently unable to handle the request
我引用的安装:
- Turs Pi,多节点集群 ->目前,了解和使用Ansible的部分似乎有些过头了
- Pi设置& k3s安装->好的教程,但是没有类似的配置响应?
- Turing Pis, multi-node cluster -> The part of knowing and using Ansible currently seems like bit of a overkill)
- Pi setup & k3s install -> Good tutorial, but not having similar config responses?
$ sudo k3s server
INFO[2020-09-30T06:58:13.488363192+01:00] Starting k3s v1.18.9+k3s1 (630bebf9)
INFO[2020-09-30T06:58:13.489450500+01:00] Cluster bootstrap already complete
FATA[2020-09-30T06:58:13.535582640+01:00] starting kubernetes: preparing server: start cluster and https: listen tcp :6443: bind: address already in use
基于较新的安装版本,假定不再需要此功能.
Presumed that this isn't necessary anymore then, based on the newer installation version.
- 完整的k3s 101 youtube ->如图所示,仍然无法正常工作.
- complete k3s 101 youtube -> Still not magically working, as shown.
因此,如果有人可以帮助我,或指导我更好地调试和显示问题,以便我理解并可以解决问题.
So if anyone is able to please help me, or guide me in a direction to better debug and display the problem so that I understand and can fix the problem.
安装反馈未显示出任何错误:
Feedback from the installation didn't display that anything went wrong:
$ sudo curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 664" sh -
[INFO] Finding release for channel stable
[INFO] Using v1.18.9+k3s1 as release
[INFO] Downloading hash https://github.com/rancher/k3s/releases/download/v1.18.9+k3s1/sha256sum-arm.txt
[INFO] Downloading binary https://github.com/rancher/k3s/releases/download/v1.18.9+k3s1/k3s-armhf
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
之后,尝试命令:
$ k3s --version
k3s version v1.18.9+k3s1 (630bebf9)
$ kubectl version
Client 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"}
Error from server (ServiceUnavailable): the server is currently unable to handle the request
$ sudo kubectl get nodes
Error from server (ServiceUnavailable): the server is currently unable to handle the request
$ sudo k3s kubectl get nodes
The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?
用htop来看,k3s服务器肯定正在发生某些事情:
And looking with htop, definitely 'something' is happening with k3s servers:
对于设备上的k3s服务器+代理,不确定是否缺少任何东西,或者必须将其更改为主机:
Not sure if anything is missing, or must be changed to hosts, for k3s server + agent on device:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi
...不知道要进一步调试什么?
... No clue what to debug further??
推荐答案
After learning a bit more of the installation process, by watching this video (k3s install on Pi4 - live walkthrough), I noticed that k3s runs as a service on 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
但是,在"/boot/cmdline.txt"中查找时,这些cgroup值在文件中的位置,但在末尾字符之后,这阻止了k3s服务从文件中充分读取.文件内容必须为:
However, looking in '/boot/cmdline.txt', these cgroup values where in the file, but after a endline-character, which prohibited the k3s service sufficiently reading from the file. File content required to be:
$ 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
完成后,我再次检查了journalctl的日志,并注意到其他有关pod容器等的日志.主节点正在运行!:
With that done, I checked journalctl again for the logs, and noticed significantly other logs, regarding pod's containers etc. Master node being functional!:
$ sudo kubectl get nodes
NAME STATUS ROLES AGE VERSION
raspberrypi Ready master 3m52s v1.18.9+k3s1
如果仍然不能解决问题,我最近也看到了一篇关于同一问题的博客文章(由于raspbian内核的更新),其中还建议了修复程序-> 发布
这篇关于PI4 k3s安装服务器当前无法处理该请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!