k8s重启报错 :The connection to the server 192.168.102.149:6443 was refused

现象

k8s重启报错

# kubectl get pods
The connection to the server xxx:6443 was refused - did you specify the right host or port?

问题排查

根据报错描述,连接kubelet的6443端口被拒绝:
查看该端口状态
显示端口未启动起来

ss -antulp | grep :6443

该端口是kubelet的api监听端口,应该是kubelet启动失败,尝试重启,查看kubelet状态,果然启动失败,分析日志

systemctl status kubelet
journalctl -xefu kubelet

有可能是部分组件启动失败,查看容器状态,发现组件都没有启动起来,重启docker以及相关容器,报错

[root@master ~]# docker ps  -a
CONTAINER ID        IMAGE                                               COMMAND                  CREATED             STATUS                      PORTS               NAMES
56f463b5684b        9b60aca1d818                                        "kube-controller-man…"   40 hours ago        Exited (2) 39 hours ago                         k8s_kube-controller-manager_kube-controller-manager-master_kube-system_8f99a56fb3eeae0c61283d6071bfb1f4_5
5043f1103f1f        aaefbfa906bd                                        "kube-scheduler --au…"   40 hours ago        Exited (2) 39 hours ago                         k8s_kube-scheduler_kube-scheduler-master_kube-system_285062c53852ebaf796eba8548d69e43_5
2d707069ab22        bfe3a36ebd25                                        "/coredns -conf /etc…"   41 hours ago        Exited (0) 39 hours ago                         k8s_coredns_coredns-6d56c8448f-mt7vz_kube-system_abc65488-0a54-4a1a-8e23-339f3f23f6d2_0
0dadfca20cb7        bfe3a36ebd25                                        "/coredns -conf /etc…"   41 hours ago        Exited (0) 39 hours ago                         k8s_coredns_coredns-6d56c8448f-hdtlf_kube-system_e1f90d02-77d0-4529-bea5-b4a72cdb4cf5_0
f25051c775cf        registry.aliyuncs.com/google_containers/pause:3.2   "/pause"                 41 hours ago        Exited (0) 39 hours ago                         k8s_POD_coredns-6d56c8448f-mt7vz_kube-system_abc65488-0a54-4a1a-8e23-339f3f23f6d2_0
b24a10712152        registry.aliyuncs.com/google_containers/pause:3.2   "/pause"                 41 hours ago        Exited (0) 39 hours ago                         k8s_POD_coredns-6d56c8448f-hdtlf_kube-system_e1f90d02-77d0-4529-bea5-b4a72cdb4cf5_0
fed8e33864c1        e708f4bb69e3                                        "/opt/bin/flanneld -…"   41 hours ago        Exited (137) 39 hours a
[root@master ~]# docker start $(docker ps -a | awk '{ print $1}' | tail -n +2)
Error response from daemon: cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"
Error response from daemon: cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"
Error response from daemon: cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"
Error response from daemon: cgroup-parent for systemd cgroup should be a valid slice named as "xxx.slice"

根据错误描述,是docker配置文件配置驱动配置错误造成的,可以直接注释掉,重启docker,重启kubelet(不要手动重启容器,因为容器之间有启动顺序,如果自己不清楚,不建议手动重启)

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 撸撸猫 设计师:设计师小姐姐 返回首页