AliCloud VPC Backend for Flannel

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

Create VPC network

Navigate to AliCloud VPC Network list page, then click [create vpc network] button. vpc

  • Set vpc name with a meaningful string.
  • Choose a subnet for the VPC:,, or Choose one according to your cluster size.
  • Click create and wait for ready.

Create switch

Click manager switch to navigate to switch list page, and create a switch.

  • Set switch name to a meaningful string.
  • Choose one AV Zone where you want to run your ECS
  • Set up a subnet which should be contained in your VPC subnet. Here we set subnet as
  • Confirm Creating.

Create instance

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. create instance

  • Select the proper VPC network.


Click find key

create key

  • If you have not yet created a key, click [create key secret] to create a new one.
  • take a note of AccessKeyId and AccessKeySecret for further use.

Launch the instance

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
  • Publish configuration in etcd (ensure that the network range does not overlap with the one configured for the VPC)
$ etcdctl set / '{"Network":"", "Backend": {"Type": "ali-vpc"}}'
  • Fetch the latest release using wget from
  • make dist/flanneld
  • Run flannel daemon:
sudo ./flanneld --etcd-endpoints=

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.