When running on Google Compute Engine, we recommend using the GCE backend which, instead of using encapsulation, manipulates IP routes to achieve maximum performance. Because of this, a separate flannel interface is not created.
From the Developers Console, we start by creating a new network.
Configure the network name and address range. Then add firewall rules to allow etcd traffic (tcp/2379), SSH, and ICMP.
That's it for the network configuration.
Now it’s time to create an instance.
Let's call it demo-instance-1
.
Under the "Management, disk, networking, access & security options" make the following changes:
<a href="img/gce-instance.png">
<img src="img/gce-instance.png" alt="New GCE Instance">
</a>
<div class="co-m-screenshot-caption">Booting a new GCE instance</div>
<a href="img/gce-instance-and-security.png">
<img src="img/gce-instance-and-security.png" alt="Security settings for a new instance">
</a>
<div class="co-m-screenshot-caption">Security settings for a new instance</div>
With the permissions set, we can launch the instance!
The only remaining steps now are to start etcd, publish the network configuration and lastly, run the flannel daemon.
SSH into demo-instance-1
and execute the following steps:
Start etcd:
$ etcd2 -advertise-client-urls http://$INTERNAL_IP:2379 -listen-client-urls http://0.0.0.0:2379
Publish configuration in etcd (ensure that the network range does not overlap with the one configured for the GCE network)
$ etcdctl set /coreos.com/network/config '{"Network":"10.40.0.0/16", "Backend": {"Type": "gce"}}'
Fetch the 0.7.0 release using wget from here
Run flannel daemon:
$ sudo ./flanneld --etcd-endpoints=http://127.0.0.1:2379
Now make a clone of demo-instance-1
and SSH into it to run the these steps:
--etcd-endpoints
flag set to the internal IP of the instance running etcdCheck that the subnet lease acquired by each of the hosts has been added!
<a href="img/gce-routes.png" class="co-m-screenshot">
<img src="img/gce-routes.png" alt="GCE Routes" />
</a>
It’s important to note that GCE currently limits the number of routes per project to 100. If you require more routes, request a quota increase or simply switch to the VXLAN backend.