Updated on 2025-01-08 GMT+08:00

Configuring Cluster Environments

Prerequisites

Two new VPCs have been created, and their CIDR blocks do not overlap. In this example, the VPC is named vpc-A and the CIDR block is 172.16.0.0/16. The other VPC is named vpc-B and the CIDR block is 172.17.0.0/16.

Creating a Cluster in the Testing Environment

  1. Log in to the CCE console and click Buy Cluster in the upper right corner on the Clusters page.
  2. Configure the cluster. The following lists some key parameter configurations. You can configure other parameters as required or use their default values. For details, see Buying a CCE Standard/Turbo Cluster.

    • Type: CCE Turbo Cluster
    • Cluster Version: Select the latest version.
    • VPC: Select vpc-A with the CIDR block of 172.16.0.0/16.

  3. Configure other parameters, complete the cluster creation, and wait until the cluster is running.
  4. In the navigation pane, choose Nodes, click the Nodes tab, and click Create Node in the upper right corner.
  5. Configure the node. The following lists some key parameter configurations. You can configure other parameters as required or use their default values. For details, see Creating a Node.

    • Specifications: Select a flavor with 4 vCPUs and 16 GiB of memory.
    • OS: Huawei Cloud EulerOS 2.0
    • EIP: Select Auto create and bind an EIP to the node. The EIP can be used to pull public network images and perform other operations.

  6. Confirm the specifications and create the node.

    One node can meet the basic requirements in this practice.

Creating a Cluster in the Production Environment

  1. Log in to the CCE console and click Buy Cluster in the upper right corner on the Clusters page.
  2. Configure the cluster. The following lists some key parameter configurations. You can configure other parameters as required or use their default values. For details, see Buying a CCE Standard/Turbo Cluster.

    • Type: CCE Turbo Cluster
    • Cluster Version: Select the latest version.
    • VPC: Select vpc-B with the CIDR block of 172.17.0.0/16.

  3. Configure other parameters, complete the cluster creation, and wait until the cluster is running.
  4. In the navigation pane, choose Nodes, click the Nodes tab, and click Create Node in the upper right corner.
  5. Configure the node pool. The following lists some key parameter configurations. You can configure other parameters as required or use their default values. For details, see Creating a Node.

    • Specifications: Select a flavor with 4 vCPUs and 16 GiB of memory.
    • OS: Huawei Cloud EulerOS 2.0
    • EIP: Select Auto create and bind an EIP to the node. The EIP can be used to pull public network images and perform other operations.

  6. Confirm the specifications and create the node. One node can meet the basic requirements in this practice.

Creating VPC Peering Connections

To enable Jenkins to access the API servers of the testing and production clusters, VPC peering connections need to be created since they are located in different VPCs.

  1. Log in to the VPC console. In the navigation pane, choose Virtual Private Cloud > VPC Peering Connections.
  2. Enable the network between the Jenkins server and the testing cluster.

    1. In the upper right corner, click Create VPC Peering Connection. Configure the parameters following instructions.
      • VPC Peering Connection Name: peering-XA
      • Local VPC: vpc-X where the Jenkins server resides
      • Peer VPC: vpc-A where the testing cluster resides
      Figure 1 Creating a VPC peering connection

    2. Click Create Now.
    3. Click the name of the created VPC peering connection and add routes.

      Click Add Route and add the CIDR block of vpc-A (172.16.0.0/16) to the route table of vpc-X.

      Select Add a route for the other VPC and add the CIDR block of vpc-X (192.168.0.0/16) to the route table of vpc-A.

      Figure 2 Adding a route

    4. Click OK.

  3. Repeat the preceding steps to enable the networking between the Jenkins server and the production cluster.

    1. In the upper right corner, click Create VPC Peering Connection. Configure the parameters following instructions.
      • VPC Peering Connection Name: peering-XB
      • Local VPC: vpc-X where the Jenkins server belongs
      • Peer VPC: vpc-B where the testing cluster resides
    2. Click OK.
    3. Click the name of the created VPC peering connection and add routes.

      Click Add Route and add the CIDR block of vpc-B (172.17.0.0/16) to the route table of vpc-X.

      Select Add a route for the other VPC and add the CIDR block of vpc-X (192.168.0.0/16) to the route table of vpc-B.

    4. Click OK.

Interconnecting with SWR

This solution uses SoftWare Repository for Container (SWR) to store container images built using Jenkins.

  1. Log in to the SWR console.
  2. Create an organization to manage images. For details, see Organization Management.
  3. Obtain the long-term valid docker login login command. For details, see Obtaining a Long-Term Valid Login Command.

    This login command will be used when images are uploaded through pipelines. For details, see Implementing Continuous Integration and Deployment.