为了学习目的,我在裸机上创建了一个集群,将一台笔记本电脑设置为控制平面,另一台笔记本电脑设置为工作节点。它们位于带有家用路由器的本地局域网中。
在完成了几次顺利的教程之后,我开始遇到连接/网络问题,并且在网上查找后发现问题比答案还多。
现在我的 CoreDNS pod 不断崩溃:他们是否应该知道 lan 路由器 IP(集群外部)?因为这在他们的日志之一中:
vaio-sve151:~$ kubectl logs -n kube-system coredns-bd6b6df9f-6t25z
[WARNING] plugin/kubernetes: starting server with unsynced Kubernetes API
.:53
[INFO] plugin/reload: Running configuration MD5 = db32ca3650231d74073ff4cf814959a7
CoreDNS-1.8.6
linux/amd64, go1.17.1, 13a9191
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:57243->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:58513->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:57970->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:37901->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:55314->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:56356->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:51310->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:39135->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:57516->10.8.191.167:53: i/o timeout
[ERROR] plugin/errors: 2 3471238297657131622.6520009371282614310. HINFO: read udp 10.244.1.43:49389->10.8.191.167:53: i/o timeout
[INFO] SIGTERM: Shutting down servers then terminating
[INFO] plugin/health: Going into lameduck mode for 5s
我的设置:
@vaio-sve151:~$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
thinkpad-x260 Ready <none> 2d19h v1.23.17 10.8.191.148 <none> Ubuntu 22.04.2 LTS 5.15.0-73-generic containerd://1.7.2
vaio-sve151 Ready control-plane,master 2d19h v1.23.17 10.8.191.138 <none> Ubuntu 20.04.6 LTS 5.4.0-150-generic containerd://1.7.2
路由器(Linksys EA3500)充当 DNS:
@vaio-sve151:~$ nslookup 10.8.191.167
167.191.8.10.in-addr.arpa name = Linksys44105.lan.
Authoritative answers can be found from:
豆荚:
vaio-sve151:~$ kubectl get pods -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default bash 1/1 Running 1 (3h29m ago) 3h32m 10.244.1.42 thinkpad-x260 <none> <none>
default kubernetes-bootcamp-65d5b99f84-7zqwb 1/1 Running 0 4h3m 10.244.1.37 thinkpad-x260 <none> <none>
default kubernetes-bootcamp-65d5b99f84-9bm48 1/1 Running 0 4h3m 10.244.1.35 thinkpad-x260 <none> <none>
default kubernetes-bootcamp-65d5b99f84-h69ps 1/1 Running 0 4h3m 10.244.1.36 thinkpad-x260 <none> <none>
kube-flannel kube-flannel-ds-8tv8v 1/1 Running 1 (3h7m ago) 3h17m 10.8.191.138 vaio-sve151 <none> <none>
kube-flannel kube-flannel-ds-tlzz6 1/1 Running 0 3h17m 10.8.191.148 thinkpad-x260 <none> <none>
kube-system coredns-bd6b6df9f-6t25z 0/1 CrashLoopBackOff 49 (4m28s ago) 3h28m 10.244.1.43 thinkpad-x260 <none> <none>
kube-system coredns-bd6b6df9f-8qzs4 0/1 CrashLoopBackOff 49 (65s ago) 3h47m 10.244.1.41 thinkpad-x260 <none> <none>
kube-system etcd-vaio-sve151 1/1 Running 17 (3h7m ago) 2d19h 10.8.191.138 vaio-sve151 <none> <none>
kube-system kube-apiserver-vaio-sve151 1/1 Running 1 (3h7m ago) 4h26m 10.8.191.138 vaio-sve151 <none> <none>
kube-system kube-controller-manager-vaio-sve151 1/1 Running 1 (3h7m ago) 4h25m 10.8.191.138 vaio-sve151 <none> <none>
kube-system kube-proxy-mgzrm 1/1 Running 1 (3h7m ago) 4h17m 10.8.191.138 vaio-sve151 <none> <none>
kube-system kube-proxy-npwrh 1/1 Running 0 4h17m 10.8.191.148 thinkpad-x260 <none> <none>
kube-system kube-scheduler-vaio-sve151 1/1 Running 1 (3h7m ago) 4h24m 10.8.191.138 vaio-sve151 <none> <none>
所有服务:
@vaio-sve151:~$ kubectl get services -A -o wide
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d19h <none>
default kubernetes-bootcamp NodePort 10.101.18.12 <none> 8080:32682/TCP 3h11m app=kubernetes-bootcamp
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 2d19h k8s-app=kube-dns
像这样的 pod在其日志中coredns-bd6b6df9f-6t25z
包含路由器 IP是正常的吗?10.8.191.167