dockerkubernetesetcdflanneldflannel

Can't Ping a Pod after Ubuntu cluster setup


I have followed the most recent instructions (updated 7th May '15) to setup a cluster in Ubuntu** with etcd and flanneld. But I'm having trouble with the network... it seems to be in some kind of broken state.

**Note: I updated the config script so that it installed 0.16.2. Also a kubectl get minions returned nothing to start but after a sudo service kube-controller-manager restart they appeared.

This is my setup:

| 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  |  

From any machine I can ping any other machine... it's when I create pods and services that I start getting issues.

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

So this pod has been spun up on KubeNode3... if I try and ping it from any machine other than it's KubeNode3 I get a Destination Net Unreachable error. 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

I can call etcdctl get /coreos.com/network/config on all four and get back {"Network":"172.16.0.0/16"}.

I'm not sure where to look from there. Can anyone help me out here?

Supporting Info

On the master node:

# 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

On a node:

# 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

Solution

  • So I noticed that the flannel configuration (/run/flannel/subnet.env) was different to what docker was starting up with (wouldn't have a clue how they got out of sync).

    # 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
    

    Note that the docker --bip=172.16.85.1/24 was different to the flannel subnet FLANNEL_SUBNET=172.16.60.1/24.

    So naturally I changed /etc/default/docker to reflect the new value.

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

    But now a sudo service docker restart wasn't erroring out... so looking at /var/log/upstart/docker.log I could see the following

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

    So the final piece to the puzzle was deleting the old bridge and restarting docker...

    # sudo brctl delbr docker0
    # sudo service docker start
    

    If sudo brctl delbr docker0 returns bridge docker0 is still up; can't delete it run ifconfig docker0 down and try again.