When running in an AliCloud VPC, we recommend using the ali-vpc backend which, instead of using encapsulation, manipulates IP routes to achieve maximum performance. Because of this, a separate flannel interface is not created.
To run flannel on AliCloud, 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. The ECS you create must sit in the same AV zone with your previously created switch.
Click to Create RAM user
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:
$ etcd --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
export ENV
export ACCESS_KEY_ID=YOUR_ACCESS_KEY_SECRET
export ACCESS_KEY_SECRET=YOUR_ACCESS_KEY_SECRET
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.