Help Center> Cloud Container Engine> Best Practices> Cluster> Creating an IPv4/IPv6 Dual-Stack Cluster in CCE
Updated on 2023-10-27 GMT+08:00

Creating an IPv4/IPv6 Dual-Stack Cluster in CCE

This section describes how to set up a VPC with IPv6 CIDR block and create a cluster and nodes with an IPv6 address in the VPC, so that the nodes can access the Internet.

Overview

IPv6 addresses are used to deal with the problem of IPv4 address exhaustion. If a worker node (such as an ECS) in the current cluster uses IPv4, the node can run in dual-stack mode after IPv6 is enabled. Specifically, the node has both IPv4 and IPv6 addresses, which can be used to access the intranet or public network.

Application Scenarios

  • If your application needs to provide Services for users who use IPv6 clients, you can use IPv6 EIPs or the IPv4 and IPv6 dual-stack function.
  • If your application needs to both provide Services for users who use IPv6 clients and analyze the access request data, you can use only the IPv4 and IPv6 dual-stack function.
  • If internal communication is required between your application systems or between your application system and another system (such as the database system), you can use only the IPv4 and IPv6 dual-stack function.

For details about the dual stack, see IPv4 and IPv6 Dual-Stack Network.

Constraints

  • Clusters that support IPv4/IPv6 dual stack:

    Cluster Type

    Cluster Network Model

    Version

    Remarks

    CCE cluster

    Container tunnel network

    v1.15 or later

    IPv4/IPv6 dual stack will be generally available for clusters of v1.23.

    ELB dual stack is not supported.

  • Worker nodes and master nodes in Kubernetes clusters use IPv4 addresses to communicate with each other.
  • If the Service type is set to LoadBalancer (DNAT), only IPv4 addresses are supported.
  • Only one IPv6 address can be bound to each NIC.
  • When IPv4/IPv6 dual stack is enabled for the cluster, DHCP unlimited lease cannot be enabled for the selected node subnet.
  • If a dual-stack cluster is used, do not change the load balancer protocol version on the ELB console.

Step 1: Create a VPC

Before creating your VPCs, determine how many VPCs, the number of subnets, and what IP address ranges you will need. For details, see Network Planning.

  • The basic operations for IPv4 and IPv6 dual-stack networks are the same as those for IPv4 networks. Only some parameters are different.
  • For details about the IPv6 billing policy, supported ECS types, and supported regions, see IPv4 and IPv6 Dual-Stack Network.

Perform the following operations to create a VPC named vpc-ipv6 and its default subnet named subnet-ipv6.

  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region and a project.
  3. Under Networking, click Virtual Private Cloud.
  4. Click Create VPC.
  5. Set the VPC and subnet parameters.

    When configuring a subnet, select Enable for IPv6 CIDR Block to automatically allocate an IPv6 CIDR block to the subnet. IPv6 cannot be disabled after the subnet is created. Currently, you are not allowed to specify a custom IPv6 CIDR block.

    Table 1 VPC configuration parameters

    Parameter

    Description

    Example Value

    Region

    Specifies the desired region. Regions are geographic areas that are physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across different regions. For lower network latency and faster access to your resources, select the region nearest you.

    AP-Singapore

    Name

    VPC name.

    vpc-ipv6

    IPv4 CIDR Block

    Specifies the Classless Inter-Domain Routing (CIDR) block of the VPC. The CIDR block of a subnet can be the same as the CIDR block for the VPC (for a single subnet in the VPC) or a subset (for multiple subnets in the VPC).

    The following CIDR blocks are supported:

    10.0.0.0/8–24

    172.16.0.0/12–24

    192.168.0.0/16–24

    192.168.0.0/16

    Enterprise Project

    When creating a VPC, you can add the VPC to an enabled enterprise project.

    An enterprise project facilitates project-level management and grouping of cloud resources and users. The name of the default project is default.

    For details about how to create and manage enterprise projects, see Enterprise Management User Guide.

    default

    Tag (Advanced Settings)

    Specifies the VPC tag, which consists of a key and value pair. You can add a maximum of ten tags for each VPC.

    The tag key and value must meet the requirements listed in Table 3.

    • Tag key: vpc_key1
    • Key value: vpc-01
    Table 2 Subnet parameter description

    Parameter

    Description

    Example Value

    AZ

    An AZ is a geographic location with independent power supply and network facilities in a region. AZs are physically isolated, and AZs in the same VPC are interconnected through an internal network.

    AZ2

    Name

    Specifies the subnet name.

    subnet-ipv6

    IPv4 CIDR Block

    Specifies the IPv4 CIDR block for the subnet. This value must be within the VPC CIDR range.

    192.168.0.0/24

    IPv6 CIDR Block

    Select Enable for IPv6 CIDR Block. An IPv6 CIDR block will be automatically assigned to the subnet. IPv6 cannot be disabled after the subnet is created. Currently, you are not allowed to specify a custom IPv6 CIDR block.

    N/A

    Associated Route Table

    Specifies the default route table to which the subnet will be associated. You can change the route table to a custom route table.

    Default

    Advanced Settings

    Gateway

    Specifies the gateway address of the subnet.

    This IP address is used to communicate with other subnets.

    192.168.0.1

    DNS Server Address

    By default, two DNS server addresses are configured. You can change them if necessary. When multiple IP addresses are available, separate them with a comma (,).

    100.125.x.x

    DHCP Lease Time

    Specifies the period during which a client can use an IP address automatically assigned by the DHCP server. After the lease time expires, a new IP address will be assigned to the client. If a DHCP lease time is changed, the new lease automatically takes effect when half of the current lease time has passed. To make the change take effect immediately, restart the ECS or log in to the ECS to cause the DHCP lease to automatically renew.

    CAUTION:

    When IPv4/IPv6 dual stack is enabled for the cluster, DHCP unlimited lease cannot be enabled for the selected node subnet.

    365 days or 300 hours

    Tag

    Specifies the subnet tag, which consists of a key and value pair. You can add a maximum of ten tags to each subnet.

    The tag key and value must meet the requirements listed in Table 4.

    • Tag key: subnet_key1
    • Key value: subnet-01
    Table 3 VPC tag key and value requirements

    Parameter

    Requirement

    Example Value

    Tag key

    • Cannot be left blank.
    • Must be unique in a VPC.
    • Can contain a maximum of 36 characters.
    • Can contain letters, digits, underscores (_), and hyphens (-).

    vpc_key1

    Tag value

    • Can contain a maximum of 43 characters.
    • Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

    vpc-01

    Table 4 Subnet tag key and value requirements

    Parameter

    Requirement

    Example Value

    Tag key

    • Cannot be left blank.
    • Must be unique for each subnet.
    • Can contain a maximum of 36 characters.
    • Can contain letters, digits, underscores (_), and hyphens (-).

    subnet_key1

    Tag value

    • Can contain a maximum of 43 characters.
    • Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

    subnet-01

  6. Click Create Now.

Step 2: Create a CCE Cluster

Creating a CCE cluster
  1. Log in to the CCE console and create a cluster.
    Complete the network settings as follows. For other configurations, see Buying a CCE Cluster.
    • Network Model: Select Tunnel network.
    • VPC: Select the created VPC vpc-ipv6.
    • Master Node Subnet: Select a subnet with IPv6 enabled.
    • IPv4/IPv6 Dual Stack: Enable this function. After this function is enabled, cluster resources, including nodes and workloads, can be accessed through IPv6 CIDR blocks.
    • Container CIDR Block: A proper mask must be set for the container CIDR block. The mask determines the number of available nodes in the cluster. If the mask of the container CIDR block in the cluster is set improperly, there will be only a small number of available nodes in the cluster.
    Figure 1 Configuring network settings
  2. Create a node.

    The CCE console displays the nodes that support IPv6. You can directly select a node. For details, see Creating a Node.

    After the creation is complete, access the cluster details page. Then, click the node name to go to the ECS details page and view the automatically allocated IPv6 address.

Step 3: Buy a Shared Bandwidth and Adding an IPv6 Address to It

By default, the IPv6 address can only be used for private network communication. If you want to use this IPv6 address to access the Internet or be accessed by IPv6 clients on the Internet, buy a shared bandwidth and add the IPv6 address to it.

If you already have a shared bandwidth, you can add the IPv6 address to the shared bandwidth without purchasing one.

Buying a Shared Bandwidth

  1. Log in to the management console.
  2. Click in the upper left corner of the management console and select a region and a project.
  3. Choose Service List > Networking > Virtual Private Cloud.
  4. In the navigation pane, choose Elastic IP and Bandwidth > Shared Bandwidths.
  5. In the upper right corner, click Buy Shared Bandwidth. On the displayed page, configure parameters as prompted.
    Table 5 Parameters

    Parameter

    Description

    Example Value

    Billing Mode

    Specifies the billing mode of a shared bandwidth. The billing mode can be:

    • Yearly/Monthly: You pay for the bandwidth by year or month before using it. No charges will be incurred for the bandwidth during its validity period.
    • Pay-per-use: You pay for the bandwidth based on the amount of time you use the bandwidth.

    Yearly/Monthly

    Region

    Specifies the desired region. Regions are geographic areas that are physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across different regions. For lower network latency and faster access to your resources, select the region nearest you.

    AP-Singapore

    Billed By

    Specifies the shared bandwidth billing factor.

    Select Bandwidth.

    Bandwidth

    Specifies the shared bandwidth size in Mbit/s. The minimum bandwidth that can be purchased is 5 Mbit/s.

    10

    Bandwidth Name

    Specifies the name of the shared bandwidth.

    Bandwidth-001

    Enterprise Project

    When assigning the shared bandwidth, you can add the shared bandwidth to an enabled enterprise project.

    An enterprise project facilitates project-level management and grouping of cloud resources and users. The name of the default project is default.

    For details about how to create and manage enterprise projects, see Enterprise Management User Guide.

    default

    Required Duration

    Specifies the required duration of the shared bandwidth to be purchased. Configure this parameter only in yearly/monthly billing mode.

    2 months

  6. Click Next to confirm the configurations and then click Buy Now.

Adding an IPv6 Address to a Shared Bandwidth

  1. On the Shared Bandwidths page, choose More > Add Public IP Address in the Operation column.
    Figure 2 Adding an IPv6 address to a shared bandwidth
  2. Add the IPv6 address to the shared bandwidth.
    Figure 3 Adding a dual-stack NIC IPv6 address
  3. Click OK.

Verifying the Result

Log in to an ECS and ping an IPv6 address on the Internet to verify the connectivity. ping6 ipv6.baidu.com is used as an example here. The execution result is displayed in Figure 4.

Figure 4 Result verification