Updated on 2023-12-21 GMT+08:00

Creating a CCE Cluster

Procedure

  1. Create a VPC and subnet. For details, see Configuring the Network.

    1. Create the cce.tf file, enter the following information, and save the file:
      resource "huaweicloud_vpc" "myvpc" {
        name = "myvpc"
        cidr = "192.168.0.0/16"
      }
      
      resource "huaweicloud_vpc_subnet" "mysubnet" {
        name          = "mysubnet"
        cidr          = "192.168.0.0/16"
        gateway_ip    = "192.168.0.1"
      
        //dns is required for cce node installing
        primary_dns   = "100.125.1.250"
        secondary_dns = "100.125.21.250"
        vpc_id        = huaweicloud_vpc.myvpc.id
      }
    2. Run terraform init to initialize the environment.
    3. Run terraform plan to view resources.
    4. After you confirm that the resource information is correct, run terraform apply to start resource creation.
    5. Run terraform show to view the created VPC and subnet.

  2. Assign an EIP. If the cluster does not use the public network, skip this step.

    1. Add the following information to the cce.tf file:
      resource "huaweicloud_vpc_eip" "myeip" {
        publicip {
          type = "5_bgp"
        }
        bandwidth {
          name        = "mybandwidth"
          size        = 8
          share_type  = "PER"
          charge_mode = "traffic"
        }
      }
    2. Run terraform plan to view resources.
    3. After you confirm that the resource information is correct, run terraform apply to start resource creation.
    4. Run terraform show to view the created EIP.

  3. Create a CCE cluster.

    1. Add the following information to the cce.tf file:
      resource "huaweicloud_cce_cluster" "mycce" {
        name                   = "mycce"
        flavor_id              = "cce.s1.small"
        vpc_id                 = huaweicloud_vpc.myvpc.id
        subnet_id              = huaweicloud_vpc_subnet.mysubnet.id
        container_network_type = "overlay_l2"
        eip                    = huaweicloud_vpc_eip.myeip.address // If you choose not to use EIP, skip this line.
      }
    2. Run terraform plan to view resources.
    3. After you confirm that the resource information is correct, run terraform apply to start resource creation.
    4. Run terraform show to view the created CCE cluster.

Table 1 Parameter description

Resource Name

Parameter

Description

huaweicloud_cce_cluster

name

(Mandatory) Cluster name.

  • Enter 4 to 128 characters, starting with a lowercase letter and not ending with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.
  • Clusters under a tenant must have unique names.

flavor_id

(Mandatory) Cluster flavor.

  • Options:
    • cce.s1.small: small-scale, single-master hybrid cluster (≤ 50 nodes)
    • cce.s1.medium: medium-scale, single-master hybrid cluster (≤ 200 nodes)
    • cce.s2.small: small-scale, multi-master hybrid cluster (≤ 50 nodes)
    • cce.s2.medium: medium-scale, multi-master hybrid cluster (≤ 200 nodes)
    • cce.s2.large: large-scale, multi-master hybrid cluster (≤ 1,000 nodes)
    • cce.s2.xlarge: ultra-large-scale, multi-master hybrid cluster (≤ 2,000 nodes)
  • Cluster flavor cannot be changed after the cluster is created.

vpc_id

(Mandatory) ID of the VPC used to create a master node.

subnet_id

(Mandatory) Network ID of the subnet used to create a master node.

container_network_type

(Mandatory) Container network type.

  • Options:
    • overlay_l2: an overlay_l2 network built for containers by using Open vSwitch (OVS).
    • underlay_ipvlan: an underlay_l2 network built for BMS nodes by using IPVlan.
    • vpc-router: an underlay_l2 network built for containers by using IPVlan and custom VPC routes.
    • eni: The Yangtse network model, which deeply integrates the native ENI capability of VPC, uses the VPC CIDR block to allocate container addresses and supports data passthrough from a load balancer to containers. This option is available when you are creating a CCE Turbo cluster (in OBT).

eip

(Optional) EIP.