weave-net 安装后状态为CrashLoopBackOff

来源:1-5 下载Kubeadm,node组件和命令行工具

千反田爱瑠爱好者

2018-09-29

老师,我根据教程下载weave.yaml后修改,添加了环境变量 IPALLOC_RANGE(第175行左右)

...
    spec:
      minReadySeconds: 5
      template:
        metadata:
          labels:
            name: weave-net
        spec:
          containers:
            - name: weave
              command:
                - /home/weave/launch.sh
              env:
                - name: HOSTNAME
                  valueFrom:
                    fieldRef:
                      apiVersion: v1
                      fieldPath: spec.nodeName
                - name: IPALLOC_RANGE
                  value: 192.168.16.0/20

安装插件

kubectl apply -f weave.yaml

查看运行状态时发现是CrashLoopBackOff

[root@node1 ~]# kubectl get pods -n kube-system -o wide
NAME                            READY   STATUS             RESTARTS   AGE     IP          NODE     NOMINATED NODE
coredns-576cbf47c7-5dgxp        0/1     Pending            0          7m37s   <none>      <none>   <none>
coredns-576cbf47c7-lgw98        0/1     Pending            0          7m37s   <none>      <none>   <none>
etcd-node1                      1/1     Running            0          6m54s   10.0.2.92   node1    <none>
kube-apiserver-node1            1/1     Running            0          6m51s   10.0.2.92   node1    <none>
kube-controller-manager-node1   1/1     Running            0          6m46s   10.0.2.92   node1    <none>
kube-proxy-5lrxh                1/1     Running            0          7m37s   10.0.2.92   node1    <none>
kube-scheduler-node1            1/1     Running            0          6m55s   10.0.2.92   node1    <none>
weave-net-fgwgp                 1/2     CrashLoopBackOff   1          4s      10.0.2.92   node1    <none>
[root@node1 ~]# kubectl describe pods weave-net-fgwgp -n kube-system
...
Events:
  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  2m29s                 default-scheduler  Successfully assigned kube-system/weave-net-fgwgp to node1
  Normal   Pulled     2m28s                 kubelet, node1     Container image "docker.io/weaveworks/weave-npc:2.4.1" already present on machine
  Normal   Created    2m28s                 kubelet, node1     Created container
  Normal   Started    2m28s                 kubelet, node1     Started container
  Normal   Pulled     97s (x4 over 2m28s)   kubelet, node1     Container image "docker.io/weaveworks/weave-kube:2.4.1" already present on machine
  Normal   Created    97s (x4 over 2m28s)   kubelet, node1     Created container
  Normal   Started    97s (x4 over 2m28s)   kubelet, node1     Started container
  Warning  BackOff    70s (x10 over 2m27s)  kubelet, node1     Back-off restarting failed container

日志信息为

[root@node1 ~]# kubectl logs weave-net-fgwgp -c weave --namespace=kube-system
Network 192.168.16.0/20 overlaps with existing route 128.0.0.0/1 on host

请问这个要怎么解决呢?谢谢。

写回答

1回答

tonybai

2018-09-30

weave plugin crash的原因是weave配置文件中的IPALLOC_RANGE设定的地址范围与该node上的路由128.0.0.1/xx有交集,存在冲突,导致weave pod启动失败。如果128.0.0.1/xx这条路由没有用,可以删除之。否则 可能需要重新 选择pod-network-cidr并设定weave的IPALLOC_RANGE,找一个和主机上路由都没有交集,都不冲突的cidr地址范围。

0
1
慕设计3399965
同样遇到了weave-net status=CrashLoopBackOff,日志如下: root@node1:/vagrant/share# kubectl logs weave-net-m4z7t -c weave --namespace=kube-system DEBU: 2019/08/25 05:56:09.810043 [kube-peers] Checking peer "5a:aa:9f:e3:d1:f3" against list &{[]} Peer not in list; removing persisted data INFO: 2019/08/25 05:56:10.062996 Command line options: map[host-root:/host http-addr:127.0.0.1:6784 metrics-addr:0.0.0.0:6782 port:6783 docker-api: conn-limit:100 expect-npc:true ipalloc-range:2.0.0.1/20 name:5a:aa:9f:e3:d1:f3 nickname:node1 db-prefix:/weavedb/weave-net ipalloc-init:consensus=1 no-dns:true datapath:datapath] INFO: 2019/08/25 05:56:10.063836 weave 2.5.2 INFO: 2019/08/25 05:56:10.118991 Bridge type is bridged_fastdp INFO: 2019/08/25 05:56:10.119010 Communication between peers is unencrypted. INFO: 2019/08/25 05:56:10.131585 Our name is 5a:aa:9f:e3:d1:f3(node1) INFO: 2019/08/25 05:56:10.132221 Launch detected - using supplied peer list: [10.0.2.15] INFO: 2019/08/25 05:56:10.342384 Checking for pre-existing addresses on weave bridge FATA: 2019/08/25 05:56:10.377194 invalid subnet - bits after network prefix are not all zero: 2.0.0.1/20
2019-08-25
共1条回复

Kubernetes实战 高可用集群搭建,配置,运维与应用

以生产为目标,原理+操作, Kubernetes结合典型云原生应用

794 学习 · 196 问题

查看课程