【问题标题】:Can't Ping a Pod after Ubuntu cluster setupUbuntu 集群设置后无法 Ping Pod
【发布时间】:2015-07-19 22:57:00
【问题描述】:

我已按照最新说明(2015 年 5 月 7 日更新)在 Ubuntu** 中使用 etcd 和 flanneld 设置集群。但我的网络有问题……它似乎处于某种损坏状态。

**注意:我更新了配置脚本以安装 0.16.2。 kubectl get minions 也没有返回任何开始,但在 sudo service kube-controller-manager restart 之后它们出现了。

这是我的设置:

| ServerName | Public IP   | Private IP |  
------------------------------------------  
| KubeMaster | 107.x.x.32  | 10.x.x.54  |  
| KubeNode1  | 104.x.x.49  | 10.x.x.55  |  
| KubeNode2  | 198.x.x.39  | 10.x.x.241 |  
| KubeNode3  | 104.x.x.52  | 10.x.x.190 |  
| MongoDev1  | 162.x.x.132 | 10.x.x.59  |  
| MongoDev2  | 104.x.x.103 | 10.x.x.60  |  

我可以从任何机器 ping 任何其他机器...当我创建 pod 和服务时,我开始遇到问题。

吊舱

POD                           IP                  CONTAINER(S)        IMAGE(S)                                HOST                            LABELS                                   STATUS              CREATED
auth-dev-ctl-6xah8            172.16.37.7         sis-auth            leportlabs/sisauth:latestdev            104.x.x.52/104.x.x.52   environment=dev,name=sis-auth            Running             3 hours

所以这个 pod 已经在 KubeNode3 上旋转了...如果我尝试从 KubeNode3 以外的任何机器上 ping 它,我会收到 Destination Net Unreachable 错误。例如

# ping 172.16.37.7
PING 172.16.37.7 (172.16.37.7) 56(84) bytes of data.
From 129.250.204.117 icmp_seq=1 Destination Net Unreachable

我可以拨打所有四个电话etcdctl get /coreos.com/network/config,然后回复{"Network":"172.16.0.0/16"}。

我不确定从那里往哪里看。有谁能帮帮我吗?

支持信息

在主节点上:

# ps -ef | grep kube
root      4729     1  0 May07 ?        00:06:29 /opt/bin/kube-scheduler --logtostderr=true --master=127.0.0.1:8080
root      4730     1  1 May07 ?        00:21:24 /opt/bin/kube-apiserver --address=0.0.0.0 --port=8080 --etcd_servers=http://127.0.0.1:4001 --logtostderr=true --portal_net=192.168.3.0/24
root      5724     1  0 May07 ?        00:10:25 /opt/bin/kube-controller-manager --master=127.0.0.1:8080 --machines=104.x.x.49,198.x.x.39,104.x.x.52 --logtostderr=true
# ps -ef | grep etcd
root      4723     1  2 May07 ?        00:32:46 /opt/bin/etcd -name infra0 -initial-advertise-peer-urls http://107.x.x.32:2380 -listen-peer-urls http://107.x.x.32:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster infra0=http://107.x.x.32:2380,infra1=http://104.x.x.49:2380,infra2=http://198.x.x.39:2380,infra3=http://104.x.x.52:2380 -initial-cluster-state new

在一个节点上:

# ps -ef | grep kube
root     10878     1  1 May07 ?        00:16:22 /opt/bin/kubelet --address=0.0.0.0 --port=10250 --hostname_override=104.x.x.49 --api_servers=http://107.x.x.32:8080 --logtostderr=true --cluster_dns=192.168.3.10 --cluster_domain=kubernetes.local
root     10882     1  0 May07 ?        00:05:23 /opt/bin/kube-proxy --master=http://107.x.x.32:8080 --logtostderr=true
# ps -ef | grep etcd
root     10873     1  1 May07 ?        00:14:09 /opt/bin/etcd -name infra1 -initial-advertise-peer-urls http://104.x.x.49:2380 -listen-peer-urls http://104.x.x.49:2380 -initial-cluster-token etcd-cluster-1 -initial-cluster infra0=http://107.x.x.32:2380,infra1=http://104.x.x.49:2380,infra2=http://198.x.x.39:2380,infra3=http://104.x.x.52:2380 -initial-cluster-state new
#ps -ef | grep flanneld
root     19560     1  0 May07 ?        00:00:01 /opt/bin/flanneld

【问题讨论】:

    标签: docker kubernetes etcd flanneld flannel


    【解决方案1】:

    请试试这个:

    ip link del docker0
    systemctl restart flanneld
    

    【讨论】:

      【解决方案2】:

      所以我注意到 flannel 配置 (/run/flannel/subnet.env) 与 docker 启动时的不同(不知道它们是如何不同步的)。

      # ps -ef | grep docker
      root     19663     1  0 May07 ?        00:09:20 /usr/bin/docker -d -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --bip=172.16.85.1/24 --mtu=1472
      
      # cat /run/flannel/subnet.env
      FLANNEL_SUBNET=172.16.60.1/24
      FLANNEL_MTU=1472
      FLANNEL_IPMASQ=false
      

      请注意,docker --bip=172.16.85.1/24 与 flannel 子网 FLANNEL_SUBNET=172.16.60.1/24 不同。

      所以我很自然地更改了/etc/default/docker 以反映新的价值。

      DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock --bip=172.16.60.1/24 --mtu=1472"
      

      但是现在sudo service docker restart 没有出错...所以查看/var/log/upstart/docker.log 我可以看到以下内容

      FATA[0000] Shutting down daemon due to errors: Bridge ip (172.16.85.1) does not match existing bridge configuration 172.16.60.1
      

      所以最后一块拼图是删除旧桥并重新启动 docker...

      # sudo brctl delbr docker0
      # sudo service docker start
      

      如果sudo brctl delbr docker0 返回bridge docker0 is still up; can't delete it 运行ifconfig docker0 down 并重试。

      【讨论】:

        猜你喜欢
        • 2019-02-08
        • 2018-05-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-05-06
        • 2020-09-10
        • 2023-01-21
        • 2020-01-05
        相关资源
        最近更新 更多