Kubernetes 主控每隔几秒就会连接失败——奇怪的错误(Debian 11 OS)

Kubernetes 主控每隔几秒就会连接失败——奇怪的错误(Debian 11 OS)
inst@k8s-master:~$ kubectl get pods -n kube-system
NAME                                       READY   STATUS             RESTARTS         AGE
calico-kube-controllers-674fff74c8-g9dkn   1/1     Running            1 (31s ago)      64s
calico-node-9rpjc                          0/1     Running            0                64s
calico-node-gfwsb                          0/1     Running            0                64s
calico-node-rp584                          0/1     Running            0                64s
coredns-5d78c9869d-dhft7                   1/1     Running            2 (25s ago)      19m
coredns-5d78c9869d-ggjb4                   1/1     Running            2 (25s ago)      19m
etcd-k8s-master                            1/1     Running            10 (5m52s ago)   18m
kube-apiserver-k8s-master                  1/1     Running            11 (5m23s ago)   19m
kube-controller-manager-k8s-master         1/1     Running            16 (3m21s ago)   18m
kube-proxy-btm5h                           0/1     CrashLoopBackOff   5 (40s ago)      15m
kube-proxy-clm69                           1/1     Running            2 (32s ago)      2m1s
kube-proxy-mnv87                           1/1     Running            15 (102s ago)    19m
kube-scheduler-k8s-master                  1/1     Running            13 (91s ago)     18m
inst@k8s-master:~$ kubectl get pods -n kube-system
The connection to the server 192.168.0.211:6443 was refused - did you specify the right host or port?

这两个命令之间大约有5-10秒

到目前为止,我尝试过重启服务器、重新加载 Linux 防火墙以及删除并重新输入防火墙上的端口。我还在 PiHole 上设置了 DNS 条目,但不幸的是,所有这些都没有帮助。

我希望集群的情况能够稳定下来。

使用 Kubeadm 初始化集群。

Pod-Network(应该可以工作)与 Calico 配合使用。

Linux 防火墙是安装在每个节点上的 UFW。

inst@k8s-master:~$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
22                         ALLOW       Anywhere                  
10250/tcp                  ALLOW       Anywhere                  
30000:32767/tcp            ALLOW       Anywhere                  
6443/tcp                   ALLOW       Anywhere                  
2379/tcp                   ALLOW       Anywhere                  
2380/tcp                   ALLOW       Anywhere                  
10251/tcp                  ALLOW       Anywhere                  
10252/tcp                  ALLOW       Anywhere                  
10255/tcp                  ALLOW       Anywhere                  
179/tcp                    ALLOW       Anywhere                  
4789/udp                   ALLOW       Anywhere                  
51820/udp                  ALLOW       Anywhere                  
51821/udp                  ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
22 (v6)                    ALLOW       Anywhere (v6)             
10250/tcp (v6)             ALLOW       Anywhere (v6)             
30000:32767/tcp (v6)       ALLOW       Anywhere (v6)             
6443/tcp (v6)              ALLOW       Anywhere (v6)             
2379/tcp (v6)              ALLOW       Anywhere (v6)             
2380/tcp (v6)              ALLOW       Anywhere (v6)             
10251/tcp (v6)             ALLOW       Anywhere (v6)             
10252/tcp (v6)             ALLOW       Anywhere (v6)             
10255/tcp (v6)             ALLOW       Anywhere (v6)             
179/tcp (v6)               ALLOW       Anywhere (v6)             
4789/udp (v6)              ALLOW       Anywhere (v6)             
51820/udp (v6)             ALLOW       Anywhere (v6)             
51821/udp (v6)             ALLOW       Anywhere (v6)     

当我重启 kubelet 时,它暂时可以工作

inst@k8s-master:~$ sudo systemctl restart kubelet
inst@k8s-master:~$ kubectl get nodes
NAME          STATUS   ROLES           AGE   VERSION
k8s-master    Ready    control-plane   50m   v1.27.1
k8s-worker1   Ready    <none>          45m   v1.27.1
k8s-worker2   Ready    <none>          32m   v1.27.1

相关内容