在Ubuntu群集设置后无法Ping一个Pod

时间:2015-05-08 22:29:42

标签: docker kubernetes etcd flanneld flannel

我已按照最新的说明(2015年5月7日更新)在ebu和flanneld中使用Ubuntu **设置群集。但是我在网络上遇到了麻烦......它似乎处于某种破碎状态。

**注意:我更新了配置脚本,使其安装了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错误。 E.g。

# 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

2 个答案:

答案 0 :(得分:0)

所以我注意到法兰绒配置(/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

请注意,泊坞窗--bip=172.16.85.1/24与法兰绒子网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,请重试。

答案 1 :(得分:-1)

请试试这个:

ip link del docker0
systemctl restart flanneld