Flannel host discovery

94 views
Skip to first unread message

AreZee1004

unread,
Jan 14, 2016, 10:23:49 PM1/14/16
to CoreOS User
Hi,

I understand that flannel exchanges state with neighboring hosts through etcd however it is not clear to me how are the neighboring hosts discovered by etcd and/or flannel. 

I followed the sample configuration on Coreos' website but could not find a reference to the IP addresses of the neighboring hosts. Am I missing something?

Thank you!
AZ1004

anton....@coreos.com

unread,
Jan 26, 2016, 5:09:51 AM1/26/16
to CoreOS User
Hi AZ1004,

When etcd has been bootstrapped, flannel uses default "/coreos.com/network" etcd prefix to store info about the network. It will randomly take "/24" subnet from the "/coreos.com/network/config" "Network" range. By default flannel uses first interface with the configured default gateway (https://github.com/coreos/flannel/blob/master/network/manager.go#L115). Then it sets subnet key into etcd, i.e. "/coreos.com/network/subnets/10.1.3.0-24" with the contents like: '{"PublicIP":"192.168.122.32"}'. Using keys located under the "/coreos.com/network/subnets/" prefix other flannel hosts can talk to each other.

It is also possible to set interface/ip manually using "iface" option. Please follow this doc https://github.com/coreos/flannel/blob/master/README.md#key-command-line-options to know how to customize flannel options.

Let me know if you have any further questions.

Best regards,
Anton

AreZee1004

unread,
Jan 26, 2016, 1:14:28 PM1/26/16
to CoreOS User
Thanks Anton. This clarifies a lot. So the flannel deployment assumes that there is previously configured and running instance of etcd on each host with the other etcd hosts configured as peers? Thanks again.

anton....@coreos.com

unread,
Jan 28, 2016, 12:17:44 PM1/28/16
to CoreOS User
Hi AZ1004,

Flannel can work without etcd, but this feature has experimental state (https://github.com/coreos/flannel/blob/master/Documentation/client-server.md). And yes, default flannel installation requires etcd. It is not necessary to run etcd member on each of your nodes. You can even run single-node etcd member and configure flannel to connect to this peer (--etcd-endpoints flag).

Regards,
Anton
Reply all
Reply to author
Forward
0 new messages