k3s server
无法 kubectl get nodes
到 k3s agent
ERROR
| ... |
| [INFO] env: Creating environment file /etc/systemd/system/k3s-agent.service.env |
| [INFO] systemd: Creating service file /etc/systemd/system/k3s-agent.service |
| [INFO] systemd: Enabling k3s-agent unit |
| [INFO] systemd: Starting k3s-agent |
| root@192-168-1-102:~# systemctl status k3s-agent |
| ● k3s-agent.service - Lightweight Kubernetes |
| Loaded: loaded (/etc/systemd/system/k3s-agent.service; enabled; vendor preset: enabled) |
| Active: activating (auto-restart) (Result: exit-code) since Fri 2021-04-23 16:46:30 CST; 1s ago |
| Docs: https://k3s.io |
| Process: 3591 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS) |
| Process: 3592 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS) |
| Process: 3593 ExecStart=/usr/local/bin/k3s agent (code=exited, status=1/FAILURE) |
| Main PID: 3593 (code=exited, status=1/FAILURE) |
| root@192-168-1-102:~# /usr/local/bin/k3s-agent-uninstall.sh |
Process: 3593 ExecStart=/usr/local/bin/k3s agent (code=exited, status=1/FAILURE)
检查发现使用 sudo su
有异常
| pi@192-168-1-102:~ $ sudo su |
| sudo: unable to resolve host 192-168-1-102: Name or service not known |
| root@192-168-1-102:/home/pi |
sudo: unable to resolve host 192-168-1-102: Name or service not known
修改 hostname
步骤有问题
| root@pi-102:/home/pi |
| |
| /etc/hostname |
| pi-102 |
| root@pi-102:/home/pi |
| |
| /etc/hosts |
| 27.0.0.1 localhost |
| ::1 localhost ip6-localhost ip6-loopback |
| ff02::1 ip6-allnodes |
| ff02::2 ip6-allrouters |
| |
| 127.0.1.1 raspberrypi |
| /etc/hosts |
| 27.0.0.1 localhost |
| ::1 localhost ip6-localhost ip6-loopback |
| ff02::1 ip6-allnodes |
| ff02::2 ip6-allrouters |
| |
| 127.0.1.1 pi-102 |
重新部署 k3s agent
并检查状态
| root@pi-102:~# systemctl status k3s-agent |
| ● k3s-agent.service - Lightweight Kubernetes |
| Loaded: loaded (/etc/systemd/system/k3s-agent.service; enabled; vendor preset: enabled) |
| Active: active (running) since Fri 2021-04-23 17:00:30 CST; 58s ago |
| Docs: https://k3s.io |
| Process: 1004 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS) |
| Process: 1007 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS) |
| Main PID: 1008 (k3s-agent) |
| Tasks: 31 |
| Memory: 184.7M |
| CGroup: /system.slice/k3s-agent.service |
| ├─1008 /usr/local/bin/k3s agent |
| └─1029 containerd |
| |
| Apr 23 17:01:19 pi-102 k3s[1008]: I0423 17:01:19.221111 1008 shared_informer.go:240] Waiting for caches to sync for endpoint slice config |
| Apr 23 17:01:19 pi-102 k3s[1008]: I0423 17:01:19.321267 1008 shared_informer.go:247] Caches are synced for service config |
| Apr 23 17:01:19 pi-102 k3s[1008]: I0423 17:01:19.321412 1008 shared_informer.go:247] Caches are synced for endpoint slice config |
在 k3s server
中测试
| root@192-168-1-100:~ |
| NAME STATUS ROLES AGE VERSION |
| 192-168-1-100 Ready control-plane,master 7h26m v1.20.6+k3s1 |
| raspberrypi-101 Ready worker 7h22m v1.20.6+k3s1 |
| pi-102 Ready <none> 30s v1.20.6+k3s1 |
| root@192-168-1-100:~ |
| node/pi-102 labeled |
| root@192-168-1-100:~ |
| NAME STATUS ROLES AGE VERSION |
| 192-168-1-100 Ready control-plane,master 7h27m v1.20.6+k3s1 |
| raspberrypi-101 Ready worker 7h23m v1.20.6+k3s1 |
| pi-102 Ready worker 98s v1.20.6+k3s1 |
:-)
奇怪的错误
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义