美文网首页Kubernetes
kubelet启动报错:node "kube-mast

kubelet启动报错:node "kube-mast

作者: 王勇1024 | 来源:发表于2019-04-19 16:53 被阅读0次

问题描述

今天在通过kubeadm安装kubernetes v1.13.1集群时,发现有一台机器始终安装不成功,总是在启动kubelet时失败,报错信息如下:

4月 19 13:52:09 kube-master1 kubelet[34770]: E0419 13:52:09.411131   34770 kubelet.go:2266] node "kube-master1" not found
4月 19 13:52:09 kube-master1 kubelet[34770]: E0419 13:52:09.511348   34770 kubelet.go:2266] node "kube-master1" not found

通过查资料,我大概知道这个错误是因为初始化kubelet时设置的master IP是错误的,才导致kubelet无法连接到master的API Server上。于是,我就去查看kubelet.conf配置文件,发现server: https://1.2.3.4:6443这项配置没有被正确修改为当前机器的IP:

$ sudo cat /etc/kubernetes/kubelet.conf
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: ****
    server: https://1.2.3.4:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes

于是,我就想尝试在部署脚本中自动获取机器IP,并修改kubelet.conf来临时解决一下这个问题:

ifconfig eth0|grep "inet addr:"|awk -F":" '{print $2}'|awk '{print $1}'

结果发现获取到的ip地址为空,于是我使用ifconfig命令去查看网卡配置情况,却发现根本没有配置eth0这个网卡~~

$ ifconfig
eth4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.120.200.1  netmask 255.255.255.0  broadcast 10.120.200.255
        ether 48:df:37:36:0a:24  txqueuelen 1000  (Ethernet)
        RX packets 1132299  bytes 633758010 (604.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1536988  bytes 1407041081 (1.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1  (Local Loopback)
        RX packets 117071  bytes 8225770 (7.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 117071  bytes 8225770 (7.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

解决方案

修改kubeadm.conf文件

kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: 1.2.3.4

1.2.3.4修改为master机器IP,然后再重新执行

# 初始化master节点
sudo kubeadm init --config kubeadm.conf

相关文章

网友评论

    本文标题:kubelet启动报错:node "kube-mast

    本文链接:https://www.haomeiwen.com/subject/lfmqgqtx.html