When running in an AliCloud VPC, we recommend using the ali-vpc backend to build your network. This prevent from package encapsulation compare to overlay network and achieve maximum performance with IP routes. Also, there is no need for an separate flannel interface to be created. In order to run flannel on AliCloud we need first create an AliCloud VPC Network
Navigate to AliCloud VPC Network list page, then click [create vpc network] button.
Click manager switch to navigate to switch list page, and create a switch.
Create an instance whose network type is VPC and then add the instance to your previous VPC network. Note: The ECS you created must sit in the same AV zone with your previous created switch.
Click find key
All that’s left now is to start etcd, publish the network configuration and run the flannel daemon.
First, SSH into instance-1
:
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 VPC)
$ etcdctl set /coreos.com/network/config '{"Network":"10.24.0.0/16", "Backend": {"Type": "ali-vpc"}}'
Fetch the latest release using wget from https://github.com/coreos/flannel/
make dist/flanneld
Run flannel daemon:
sudo ./flanneld --etcd-endpoints=http://127.0.0.1:2379
Next, create and connect to a clone of instance-1
.
Run flannel with the --etcd-endpoints
flag set to the internal IP of the instance running etcd.
Confirm that the subnet route table has entries for the lease acquired by each of the subnets.
Keep in mind that the AliCloud VPC limits the number of entries per route table to 50. If you require more routes, request a quota increase or simply switch to the VXLAN backend.