Ubuntu 22.04 上的 k3s 网络问题:无法获取 Kubernetes 服务器版本:获取 \"https://10.43.0.1:443/version?timeout=32s\":i/o 超时
k3s networking problems on Ubuntu 22.04: failed to get Kubernetes server version: Get \"https://10.43.0.1:443/version?timeout=32s\": i/o timeout
从 Ubuntu 20.04 LTS 升级到 Ubuntu 22.04 LTS 后,我的 k3s 集群目前遇到问题。
例如,local-path-provisioner
pod 的日志:
$ kubectl logs -n kube-system local-path-provisioner-6c79684f77-l4cqp
time="2022-04-28T03:27:00Z" level=fatal msg="Error starting daemon: Cannot start Provisioner: failed to get Kubernetes server version: Get \"https://10.43.0.1:443/version?timeout=32s\": dial tcp 10.43.0.1:443: i/o timeout"
我尝试了以下操作:
- 禁用 ipv6,如所述here
- 禁用
ufw
防火墙
- 使用旧版 iptables
- 向 iptables 添加内部流量规则,如下所示:
$ sudo iptables -A INPUT -s 10.42.0.0/16 -d <host_ip> -j ACCEPT
coredns
、local-path-provisioner
和 metrics-server
部署仍然不会启动。列出 pods 时,输出如下:
$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
cilium-64r4c 1/1 Running 2 (18m ago) 174m
cilium-d8grw 1/1 Running 2 (18m ago) 174m
cilium-g4gmf 1/1 Running 2 (18m ago) 174m
cilium-h5j4h 1/1 Running 2 (18m ago) 174m
cilium-n62nv 1/1 Running 2 (18m ago) 174m
cilium-operator-76cff99967-6fgkv 1/1 Running 2 (18m ago) 174m
cilium-operator-76cff99967-pbr4l 1/1 Running 2 (18m ago) 174m
cilium-w4n6d 1/1 Running 2 (18m ago) 174m
cilium-wgm7l 1/1 Running 2 (18m ago) 174m
cilium-zqb6w 1/1 Running 2 (18m ago) 174m
coredns-d76bd69b-bhgnl 0/1 CrashLoopBackOff 44 (3m27s ago) 177m
hubble-relay-67f64789c7-cjzz9 0/1 CrashLoopBackOff 63 (4m15s ago) 174m
hubble-ui-794cd44b77-9vgbl 3/3 Running 6 (18m ago) 174m
local-path-provisioner-6c79684f77-l4cqp 0/1 CrashLoopBackOff 35 (3m53s ago) 177m
metrics-server-7cd5fcb6b7-v74rc 0/1 CrashLoopBackOff 42 (3m35s ago) 177m
感谢任何帮助!谢谢
我遇到了同样的问题并发现了这个:https://github.com/k3s-io/k3s/issues/5443
您必须另外安装 linux-modules-extra-raspi:
sudo apt install linux-modules-extra-raspi
$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
local-path-provisioner-84bb864455-bvnfh 1/1 Running 0 3m6s
coredns-96cc4f57d-28vkv 1/1 Running 0 3m6s
metrics-server-ff9dbcb6c-m8cfd 1/1 Running 0 3m6s
由于您使用的是 Cilium,我认为您可能 运行 遇到了这个问题:https://github.com/cilium/cilium/issues/10645
解决方法是确保 net.ipv4.conf.lxc*.rp_filter
设置为 0:
echo 'net.ipv4.conf.lxc*.rp_filter = 0' | sudo tee -a /etc/sysctl.d/90-override.conf
sudo systemctl start systemd-sysctl
从 Ubuntu 20.04 LTS 升级到 Ubuntu 22.04 LTS 后,我的 k3s 集群目前遇到问题。
例如,local-path-provisioner
pod 的日志:
$ kubectl logs -n kube-system local-path-provisioner-6c79684f77-l4cqp
time="2022-04-28T03:27:00Z" level=fatal msg="Error starting daemon: Cannot start Provisioner: failed to get Kubernetes server version: Get \"https://10.43.0.1:443/version?timeout=32s\": dial tcp 10.43.0.1:443: i/o timeout"
我尝试了以下操作:
- 禁用 ipv6,如所述here
- 禁用
ufw
防火墙 - 使用旧版 iptables
- 向 iptables 添加内部流量规则,如下所示:
$ sudo iptables -A INPUT -s 10.42.0.0/16 -d <host_ip> -j ACCEPT
coredns
、local-path-provisioner
和 metrics-server
部署仍然不会启动。列出 pods 时,输出如下:
$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
cilium-64r4c 1/1 Running 2 (18m ago) 174m
cilium-d8grw 1/1 Running 2 (18m ago) 174m
cilium-g4gmf 1/1 Running 2 (18m ago) 174m
cilium-h5j4h 1/1 Running 2 (18m ago) 174m
cilium-n62nv 1/1 Running 2 (18m ago) 174m
cilium-operator-76cff99967-6fgkv 1/1 Running 2 (18m ago) 174m
cilium-operator-76cff99967-pbr4l 1/1 Running 2 (18m ago) 174m
cilium-w4n6d 1/1 Running 2 (18m ago) 174m
cilium-wgm7l 1/1 Running 2 (18m ago) 174m
cilium-zqb6w 1/1 Running 2 (18m ago) 174m
coredns-d76bd69b-bhgnl 0/1 CrashLoopBackOff 44 (3m27s ago) 177m
hubble-relay-67f64789c7-cjzz9 0/1 CrashLoopBackOff 63 (4m15s ago) 174m
hubble-ui-794cd44b77-9vgbl 3/3 Running 6 (18m ago) 174m
local-path-provisioner-6c79684f77-l4cqp 0/1 CrashLoopBackOff 35 (3m53s ago) 177m
metrics-server-7cd5fcb6b7-v74rc 0/1 CrashLoopBackOff 42 (3m35s ago) 177m
感谢任何帮助!谢谢
我遇到了同样的问题并发现了这个:https://github.com/k3s-io/k3s/issues/5443
您必须另外安装 linux-modules-extra-raspi:
sudo apt install linux-modules-extra-raspi
$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
local-path-provisioner-84bb864455-bvnfh 1/1 Running 0 3m6s
coredns-96cc4f57d-28vkv 1/1 Running 0 3m6s
metrics-server-ff9dbcb6c-m8cfd 1/1 Running 0 3m6s
由于您使用的是 Cilium,我认为您可能 运行 遇到了这个问题:https://github.com/cilium/cilium/issues/10645
解决方法是确保 net.ipv4.conf.lxc*.rp_filter
设置为 0:
echo 'net.ipv4.conf.lxc*.rp_filter = 0' | sudo tee -a /etc/sysctl.d/90-override.conf
sudo systemctl start systemd-sysctl