..

weave 插件 CrashLoopBackOff

新安装的高可用 k8s 集群,有一个节点加入到集群以后,网络通讯一直不正常

weave-net-bncrx                                              1/2     CrashLoopBackOff   8          11m

这个 pod 有2个容器,有一个容器无法启动,通过 kubect logs 查看日志

[root@master01v runner]# kubectl logs weave-net-bncrx -c weave -n kube-system
Network 192.168.0.0/16 overlaps with existing route 192.168.0.0/20 on host

服务器上已经存在了到 192.168 的路由信息,路由冲突了,到服务器上看一眼,docker0 网卡的 ip 子网似乎不正常

[root@kuberntes05v licong]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether fa:16:3e:8a:11:85 brd ff:ff:ff:ff:ff:ff
            ... 删除内容 ...
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
    link/ether 02:42:20:e0:4f:6e brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/20 brd 192.168.15.255 scope global docker0
       valid_lft forever preferred_lft forever

于是我修改一下 docker0 的子网设置

systemctl stop docker
ip link del docker0

重新在 /etc/docker/daemon.json 中指定一些网络范围:

{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2",
  "bip": "172.26.0.1/16"
}

重启 docker

systemctl start 

然后重新加入节点,一切恢复正常。