* docker overlay network
** multi host deploy arch
+-------------------- VM1 ------------------+ +-------------------- VM2 ------------------+
| +-------+ +-------+ +-------+ | | +-------+ +-------+ +-------+ |
| | KV | | App 1 | | App 2 | | | | KV | | App 1 | | App 2 | |
| +-------+ +-------+ +-------+ | | +-------+ +-------+ +-------+ |
| +---------------------------------+ | | +---------------------------------+ |
| | docker | | | | docker | |
| +---------------------------------+ | | +---------------------------------+ |
+----------------- region 1 ----------------+ +----------------- region 2 ----------------+
*** distributed kv (consul, etcd, zookeeper etc.) for storing vxlan information
*** using public network ip for cross region / using private network ip for same region
** docker overlay network arch
+------------------------------ VM ----------------------------------+
| +------------------- container adapter ---------------------+ |
| | +-----------------------+ +-----------------------+ | |
| | | eth1 | | eth0 | | |
| | | 192.168.16.6 | | 10.0.0.2 | | |
| | +----------|------------+ +------------|----------+ | |
| +-------------|--------------------------------|-------------+ |
| | | |
| +-------------|------ virtual adapter --------V-------------+ |
| | V +-- veth --+ | |
| | +---------- vm ---------+ +---------- ns ---------+ | |
| | | docker_gwbridge | | br0 | | |
| | | 192.168.16.1/20 | | 10.0.0.1 | | |
| | +----------|------------+ +-----------|-----------+ | |
| | | +-------- vxlan --------+ | |
| +-------------|-------------------------------|--------------+ |
| NAT | | |
| |------------------------------ | |
| | |
| +-------------------- physical adapter -------V--------------+ |
| | +-----------------------+ +-----------------------+ | |
| | | eth0 | | eth1 | | |
| | | 10.251.22.206 | | 121.42.163.81 | | |
| | +-----------------------+ +-----------------------+ | |
| +------------------------------------------------------------+ |
+----------------------------------------------------------------------+
** using docker overlay network in aliyun ecs
*** upgrade linux kernel to > 3.16
sudo apt-get install linux-generic-lts-vivid
*** install distributed kv (consul, etcd, zookeeper etc. ) and run
curl -OL https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
*** docker create overlay network
docker network create -d overlay prod
*** docker run with overlay network
docker run -t -t --net prod ubuntu /bin/bash
*** set namespace bridge and arp
ip netns exec 1-63e4c396fe bridge fdb add 02:42:0a:00:00:03 dev vxlan1 dst 121.42.163.81
ip netns exec ca993c48d217 arp -s 10.0.0.3 02:42:0a:00:00:03
** reference docs
http://115.28.140.124:8000
https://github.com/docker/libnetwork/blob/master/docs/overlay.md
http://askubuntu.com/questions/636221/ubuntu-14-04-with-3-19-kernel-wants-to-update-to-3-16
http://hustcat.github.io/docker-overlay-network-practice/
http://hustcat.github.io/overlay-network-base-ovs/
http://www.slideshare.net/neependra/docker-multi-host-networking-rachit-arora-ibm
http://sirile.github.io/2015/09/30/cassandra-cluster-on-docker-swarm-and-overlay-networking-using-docker-experimental-1.9.html
https://github.com/docker/docker/releases