Help Center/ Cloud Container Engine/ Best Practices/ Networking/ Connecting a Cluster to the Peer VPC Through an Enterprise Router
Updated on 2024-07-04 GMT+08:00

Connecting a Cluster to the Peer VPC Through an Enterprise Router

Application Scenarios

An enterprise router connects virtual private clouds (VPCs) and on-premises networks to build a central hub network and implement communication between VPCs in the same region. It has high specifications, provides high bandwidth, and delivers high performance. With the enterprise routers, CCE clusters in different VPCs can access each other.

Clusters in different VPCs cannot communicate with VMs in the peer VPCs within a short period of time after containers are created in the clusters. To solve this problem, attach the peer VPCs to the enterprise routers. In a CCE Turbo cluster, configure parameters to delay the pod startup to solve this problem. For details, see Configuring Parameters to Delay the Pod Startup in a CCE Turbo Cluster.

Network Planning

Before attaching VPCs to the enterprise routers, determine the VPC CIDR blocks and the enterprise routers' route table. Ensure that the following requirements are met.

Resource

Description

VPC

  • The VPC CIDR blocks cannot overlap.
  • The CIDR blocks of the VPCs are propagated to the enterprise routers' route tables. These CIDR blocks cannot be modified. Overlapping CIDR blocks may cause route conflicts. Additionally, the container CIDR blocks cannot conflict with the node CIDR blocks in the peer VPCs. Otherwise, the network is unavailable.
  • If your existing VPCs have overlapping CIDR blocks, manually add static routes to the route tables of the enterprise routers. The destination can be the VPC subnet CIDR blocks or smaller ones.

Enterprise router

After Default Route Table Association and Default Route Table Propagation are enabled and a VPC attachment is created, the system automatically:

  • Associates the VPC attachment with the default route table of the enterprise router.
  • Propagates the VPC attachment to the default route table of the enterprise router. The route table automatically learns the VPC CIDR blocks.

For details, see Step 1: Plan Networks and Resources.

Creating an Enterprise Router

  1. Log in to the management console.
  2. Click in the upper left corner and select the desired region and project.
  3. Choose Service List > Networking > Enterprise Router.
  4. Enter the Enterprise Router page.
  5. Click Create Enterprise Router in the upper right corner.
  6. Enter the Create Enterprise Router page.
  7. Configure basic information following instructions. For details about the parameter settings, see Table 1.

    Figure 1 Creating an enterprise router
    Table 1 Parameters for creating an enterprise router

    Parameter

    Setting

    Example Value

    Region

    Select the region nearest to your target users. Once the enterprise router is created, the region cannot be changed.

    CN-Hong Kong

    AZ

    Select two AZs to deploy your enterprise router. You can change them after the enterprise router is created.

    AZ1

    AZ2

    Name

    Specify the enterprise router name. You can change it after the enterprise router is created.

    er-test-01

    ASN

    Enter an ASN based on your network plan. It cannot be changed after the enterprise router is created.

    64512

    Default Route Table Association

    If you select this option, you do not need to create route tables or associations. You can change your option after the enterprise router is created.

    Enable

    Default Route Table Propagation

    If you select this option, you do not need to create route tables, propagations, or routes. You can change your option after the enterprise router is created.

    Enable

    Auto Accept Shared Attachments

    If you do not select this option, you must accept the requests for creating attachments to this enterprise router from other users with whom this enterprise router is shared.

    Disable

    Enterprise Project

    Select an enterprise project for the enterprise router. You can change it after the enterprise router is created.

    default

    Tag

    Add tags to help you identify your enterprise router. You can change them after the enterprise router is created.

    Tag key: test

    Tag value: 01

    Description

    Provide supplementary information about the enterprise router. You can change it after the enterprise router is created.

    -

  8. Click Create Now.
  9. Check the information on the page displayed and click Submit. Back to the enterprise router list.
  10. View the enterprise router's status. If its status changes from Creating to Normal, the enterprise router is created.

    Figure 2 Created an enterprise router

Creating a VPC Attachment to an Enterprise Router

  1. Log in to the management console.
  2. Click in the upper left corner and select the desired region and project.
  3. Choose Service List > Networking > Enterprise Router. Enter the Enterprise Router page.
  4. Search for the target enterprise router by name.
  5. Perform either of the following operations to go to the Attachments tab:

  6. Click Create Attachment. The Create Attachment page is displayed.
  7. Configure the parameters as prompted. For details, see Table 2.

    Figure 3 Creating an attachment
    Table 2 Parameter description

    Parameter

    Setting

    Example Value

    Name

    Specify the name of the VPC attachment. You can change it after the attachment is created.

    er-attach-01

    Attachment Type

    Select VPC. The type cannot be changed after the attachment is created.

    VPC

    Attached Resource

    1. Select the VPC to be attached to the enterprise router from the drop-down list. The VPC cannot be changed after the attachment is created.
    2. Select the subnet to be attached to the enterprise router from the drop-down list. The subnet cannot be changed after the attachment is created.
    • VPC: vpc-demo-01
    • Subnet: subnet-demo-01

    Auto Add Routes

    • If you enable Auto Add Routes when creating a VPC attachment, you do not need to manually add static routes to the VPC route table. Instead, the system automatically adds routes (with this enterprise router as the next hop and 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 as the destinations) to all route tables of the VPC.
    • If an existing route in the VPC route tables has a destination to 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16, the routes will fail to be added. In this case, do not enable Auto Add Routes. After the attachment is created, manually add routes.
    • Do not set the destination of a route (with an enterprise router as the next hop) to 0.0.0.0/0 in the VPC route table. If an ECS in the VPC has an EIP bound, the VPC route table will have a policy-based route with 0.0.0.0/0 as the destination, which has a higher priority than the route with the enterprise router as the next hop. In this case, traffic is forwarded to the EIP and cannot reach the enterprise router.

    Enable

    Description

    Provide supplementary description about the attachment. You can change it after the attachment is created.

    -

    Tag

    Add tags to help you identify your attachment. You can change them after the attachment is created.

    Tag key: test

    Tag value: 01

  8. Click Create Now. If the status changes from Creating to Normal, the attachment is created. Repeat steps 6 to 7 to attach other VPCs.

    Figure 4 Attaching a VPC to the enterprise router

Verifying the Network

  1. Log in to the CCE console and search for the CCE cluster that has been attached to the VPC.
  2. Click the name of the target cluster. In the navigation pane, choose Nodes to view the IP address of the node.

    Figure 5 Viewing the IP address of the node on the CCE console

  3. Log in to the node. For details, see Logging In to a Node. In this example, use VNC provided on the management console to log in to the ECS.
  4. Run the following command on the ECS console:

    ping {ECS address}

    Take the cluster in vpc-ER-demo2 as an example. Log in to the er-demo2-04260 node and access the er-demo1-61379 node in the cluster in vpc-ER-demo1. The IP address of the node is 192.168.0.131.

    ping 192.168.0.131

    If the following information is displayed, the network is accessible.

    Figure 6 Viewing the command output

  5. Repeat the preceding steps to verify the communication between nodes.

    If a node using the peer VPC cannot be pinged, check:

    1. Whether the security group rules of the node allow the ICMP protocol.
    2. Whether a CIDR block conflict occurs in the VPC route table. Note that the container CIDR blocks cannot conflict with the default CIDR blocks of the enterprise routers. For details, see Network Planning.
      Figure 7 Viewing the VPC route table