IBM Cloud Docs
Creating a cluster network subnet

Creating a cluster network subnet

Contact your IBM Support representative if you are interested in getting early access to this offering. It is currently available for early access users of the gx3d-160x1792x8h100 virtual server instance profiles in the us-east region.

A cluster network subnet is a subnet within a cluster network. While it resembles a VPC subnet, it offers fewer features. However, it does let you define the subnet CIDR and configure reserved IPs for the cluster network subnet. These reserved IPs include addresses you specify and come with an auto-delete function similar to that of VPC subnet reserved IPs.

Before you begin

Review Planning considerations and Known issues and limitations.

You can create a cluster network subnet with the UI, CLI, API, or Terraform.

Creating a cluster network subnet in the UI

To create a subnet within a network cluster in the UI, follow these steps:

  1. From your browser, open the IBM Cloud console and log in to your account.

  2. Select the Navigation Menu menu icon, then click Infrastructure > Network > Cluster networks.

  3. On the Cluster networks for VPC page, click the link of the cluster network name where you want to create a subnet. The Overview page displays.

  4. Click the Subnets tab to show the Cluster network subnets table, then click Create +.

  5. Complete the information in the Create subnet side panel, then click Create.

    • Enter a subnet name.
    • Review the address prefix. Change as needed.
    • Select the number of total IP addresses (default is 256).
    • Review the IP range stated. Change as needed.
    • Review the specified address space. Adjust the IP range as needed.

The cluster network subnet is requested for use.

Creating a cluster network subnet in the CLI

To create a cluster network subnet in the CLI, follow these steps:

  1. Set up your CLI environment.

  2. Log in to your account with the CLI. After you enter the password, the system prompts for the account and region that you want to use:

    ibmcloud login --sso
    
  3. Enable the following feature flag:

    export IBMCLOUD_IS_FEATURE_CLUSTER_NETWORK=true
    
  4. To create a cluster network subnet, enter the following command:

    ibmcloud is cluster-network-subnet-create CLUSTER_NETWORK (--total-ipv4-address-count TOTAL_IPV4_ADDRESS_COUNT | --ipv4-cidr-block IPV4_CIDR_BLOCK) [--name NAME] [--ip-version IP_VERSION] [--output JSON] [-q, --quiet]
    

    Where:

    CLUSTER_NETWORK
    ID or name for the cluster network.
    --total-ipv4-address-count
    The total number of IPv4 addresses required. Must be a power of 2.
    --ipv4-cidr-block
    The IPv4 range of the cluster network subnet, expressed in CIDR format.
    --name
    The name for this cluster network subnet.
    --output
    Specify output format, only JSON is supported. One of: JSON.
    -q, --quiet
    Suppress verbose output.

Command example

To create a cluster network subnet with name cli-cn-sub-1 for cluster network cli-cn-1:

ibmcloud is cluster-network-subnet-create cli-cn-1 --name cli-cn-sub-1 --total-ipv4-address-count 32

Creating a cluster network subnet with the API

To create a cluster network subnet with the API, follow these steps:

  1. Set up your API environment with the right variables.

  2. Store any additional variables to be used in the API commands; for example:

    version (string): The API version, in format YYYY-MM-DD.

  3. When all variables are initiated, run the following command to create the cluster network subnet:

    curl -X POST "$vpc_api_endpoint/v1/cluster_networks/$cluster_network_id/subnets?version=$tomorrow&generation=2&maturity=development" -H "Authorization: Bearer $iam_token" -d '{
          "name": "my-cluster-network-subnet",
          "total_ipv4_address_count": 2048
        }'
    

To view the complete set of cluster network APIs, see the VPC API reference.

Creating a cluster network subnet with Terraform

Terraform will support this feature after it reaches General Availability (GA) and is officially released.

The following example provisions a cluster network subnet by using Terraform:

resource "ibm_is_cluster_network_subnet" "is_cluster_network_subnet_instance" {
  cluster_network_id        = var.is_cluster_network_subnet_cluster_network_id
  ip_version                = var.is_cluster_network_subnet_ip_version
  name                      = var.is_cluster_network_subnet_name
  total_ipv4_address_count  = var.is_cluster_network_subnet_total_ipv4_address_count
  // ipv4_cidr_block = var.is_cluster_network_subnet_ipv4_cidr_block #conflicts with total_ipv4_address_count
}