All Products
Document Center

Container Service for Kubernetes:Configure BGP networks for data centers

Last Updated:Apr 02, 2024

If your data center uses a Border Gateway Protocol (BGP) network in a hybrid cloud environment, you can use only the BGP Peer mode. In this case, the switches and routers that are used in the data center must support BGP. Calico is a networking solution that supports overlay networks and BGP networks. This topic describes how to use Calico to configure container networks for Kubernetes clusters that are deployed in data centers.


Background Information

The following figure shows how a data center is connected to Alibaba Cloud.



  1. Install the calicoctl command-line tool. For more information, see Install calicoctl.

  2. Use calicoctl to create resource objects that are used to configure a Calico network policy based on the following template.

        "Version": "1",
        "Statement": [
                "Effect": "Allow",
                "Action": [
                "Resource": "acs:arms:cn-hangzhou:*:prometheus/*"

    Set the asNumber and peerIP parameters based on your data center.

    kubectl apply -f - << EOF
    kind: BGPConfiguration
      name: default
      logSeverityScreen: Info
      nodeToNodeMeshEnabled: false
      asNumber: 64513
    kubectl apply -f - << EOF
    kind: BGPPeer
      name: my-global-peer
      asNumber: 64513
  3. Use one of the following methods to check whether a new route entry is added.

    • Use calicoctl to check whether a new route entry is added.

      [root@master ~]# ./calicoctl node status
      Calico process is running.
      IPv4 BGP status
      | PEER ADDRESS | PEER TYPE | STATE |  SINCE   |    INFO     |
      |  | global    | up    | 03:38:03 | Established |
      IPv6 BGP status
      No IPv6 peers found.
    • Check whether a new route entry is added to the custom route table of the virtual private cloud (VPC) that is attached to the CEN instance.

      1. Log on to the VPC console.

      2. In the left-side navigation pane, click Route Tables.

      3. On the Route Tables page, click the name of the route table to go to the details page.

      4. Click Route Entry List. Then, click Cloud Enterprise Network to verify that a new route entry is added to the route table.