Creating a Cluster

Last updated: 2021-08-19 14:13:05


    Tencent Cloud TKE offers two ways to create clusters: creating a cluster via template and customizing a cluster. This document describes how to create clusters and all necessary resources, such as VPCs, subnets, and security groups, using templates and custom configurations.


    Before creating a cluster, you need to complete the following preparations:


    Creating a cluster via templates

    1. Log in to the TKE console and click Cluster in the left sidebar.
    2. In the Cluster Management page, click Create with a Template above the cluster list, as shown below:
    3. Multiple templates are provided for creating managed clusters, self-deployed clusters, and elastic clusters. You can choose a template based on your actual requirements.
      • Managed cluster: if you create a Kubernetes managed cluster, you do not need to purchase and manage the cluster master node and only need to purchase worker node resources to deploy business applications.
      • Self-deployed cluster: if you create a self-deployed Kubernetes cluster, you need to purchase and manage the master and worker nodes of the cluster. You will have all the management and operation permissions of the cluster.
      • Elastic cluster: if you create a serverless Kubernetes cluster, you do not need to manage any node resources of the cluster and can quickly deploy business applications.
    4. This document uses the “Basic Cluster” template under Managed Cluster as an example. Select the Basic Cluster and go to the Create Basic Cluster page.

      When using a cluster template to create a cluster, all configuration items adopt their default values. You can directly click Next or refer to the directions in customizing a cluster to customize the configuration.

    5. Click Done.

    Customizing a cluster

    Entering cluster information

    1. Log in to the TKE console and click Clusters in the left sidebar.
    2. On the "Cluster Management" page, click Create above the cluster list.
    3. On Create Cluster page, configure the basic information of the cluster as shown in the figure below:
      • Cluster Name: the name of the cluster to be created, with a length up to 60 characters.
      • Project of New-added Resource: select a project as needed. The newly added resources will be automatically assigned to this project.
      • Kubernetes Version: multiple Kubernetes versions are available. For feature comparison between different versions, see Supported Versions of the Kubernetes Documentation.
      • Runtime Component: choose docker or containerd. For details, see How to Choose Containerd and Docker.
      • Region: the region where the cluster will be created. We recommend that you select a region close to your customers to minimize the access latency and improve the download speed.
      • Cluster Network: assigns IP addresses that are within the node IP range to CVMs in the cluster. For details, see Network Settings for Containers and Nodes.
      • Container Network Add-on: Global Router and VPC-CNI network modes are provided. For more information, see How to Choose TKE Network Mode.
      • Container Network: assigns IP addresses that are within the container network address range to containers in the cluster. For details, see Network Settings for Containers and Nodes.
      • Operating System: select an operating system based on your actual requirements.
      • Cluster Description: enter information about the cluster, which will be displayed on the Cluster information page.
      • Advanced Settings (optional):
        • Tencent Cloud Tags: after binding tags to the cluster, you can categorize the resources. For more information, see Querying Resources by Tag.
        • Deletion Protection: when it's enabled, the cluster will not be deleted by mis-operation on console or by API.
        • Kube-proxy Proxy Mode: select iptables or ipvs. IPVS mode is applicable to large-scale services. You cannot disable it once it is enabled. For details, refer to Enabling IPVS for a Cluster.
        • Custom Parameters: specify the custom parameters to configure the cluster.
        • Runtime Version: select the version of the container runtime component.
    4. Click Next.

    Selecting a Model

    1. In Select Model page, confirm the billing mode, select an availability zone and the corresponding subnet, and confirm the node model, as shown below:
      • Node Source: there are two options: Add node and Existing nodes.

    Create a cluster by adding nodes (that is, by adding CVMs). The details are as follows:

    In the Select Model step, select a deployment mode and model based on the following information, as shown below:

    The main parameters are described as follows:

    • Master Node: the deployment mode of the Master node determines the management mode of your cluster. The Managed and Self-deployed cluster management modes are available. For details, see Cluster Overview. In this document, Managed is used as an example.
      • Billing Mode: pay-as-you-go is supported. For details, see Billing Plans.
    • Worker Configurations: when Node Source is set to Add Node, the settings under this module are as above by default. You can change them based on your actual requirements.
      • Availability Zone: you can select multiple availability zones at the same time to deploy your Master or Etcd nodes to ensure higher availability of the cluster.
      • Node Network: you can select multiple subnet resources at the same time to deploy your Master or Etcd nodes to ensure higher availability of the cluster.
      • Model: choose a model higher than CPU 4-core. For details, see Instance Types.
      • System disk: the default value is HDD cloud disk - 50 GB. You can select local disk, HDD cloud disk, SSD cloud disk, or premium cloud disk based on your actual model. For details, see Storage Overview.
      • Data disk: as it is not recommended to deploy other applications in the Master and Etcd nodes, no data disk is configured for them by default. You can purchase one and add it if needed.
      • Public network bandwidth: select Assign free public IP and the system will assign a public IP address for free. Two billing methods are available. For details, see Public Network Billing.
      • Node Name: the name of the computer in the OS (the node name displayed by running the kubectl get nodes command`). It is a cluster attribute. The node name can be named in the following two modes:
        • Auto-generated: the node name defaults to the private IP of the node.
        • Custom Name: you can use sequential numbering or custom format string. It can contains 2-60 characters, including lower-case letters, numbers, hyphens ("-") and periods ("."). Symbols cannot be placed at the beginning nor end, and cannot be used consecutively. For more naming rules, see Batch Sequential Naming or Pattern String-Based Naming.

          Due to the naming restriction of kubernetes node, you can only use the lower-case letters when customizing the node name, for example, 'cvm {R:13}-big{R:2}-test'.

        • Instance Name: the CVM instance name displayed in the console, which is determined by the naming mode of host name.
          • When the node name is automatically generated, it supports sequential numbering or custom format for multiple instances. Up to 60 characters allowed. The instance name is automatically generated by default in the format of tke_cluster id_worker.
          • When the node name is customized, the instance name is the same as the hostname without reconfiguration.
      • Amount: set the number of instances as needed.

        In the self-deployed mode, you can refer to the Worker configuration for the configuration settings of the Masters model. At least three Master models should be deployed. Cross-AZ deployment is supported.

    2. Click **Next** to start [configuring a CVM](#ConfigureCVM).

    CVM configuration

    1. In the “CVM Configuration” step, configure a CVM based on the following information, as shown below:
      • Container Directory: check this option to set up the container and image storage directory. We recommend that you store to the data disk, such as /var/lib/docker.
      • Security Group: the security group works as a firewall to control network access of the CVM. The following settings are supported:
        • Create and bind the default security group. You can preview the default security group rules.
        • Add security group to configure custom security group rules according to your actual needs.
          For details, see TKE Security Group Settings.
      • Login Method: three login methods are available.
        • SSH Key Pair: a key pair is a pair of parameters generated by an algorithm. Compared to regular passwords, it is a more secure way to log in to a CVM. For details, see SSH Key.
        • Random Password: the system sends an automatically generated password to your Message Center.
        • Custom Password: set a password as prompted.
      • Security Services: free DDoS Protection, Web Application Firewall (WAF), and Cloud Workload Protection are activated by default. For more information, see Cloud Workload Protection.
      • Cloud Monitor: free monitoring, analysis, and alarms are activated by default, and components are installed to obtain CVM monitoring metrics. For more information, see Cloud Monitor.
    2. (Optional) Click Advanced Settings to view or configure more information, as shown in the following figure.
      • CAM Role: you can bind all the nodes created this time to the same CAM role, and grant the authorization policy bound to the role to the nodes. For more information, see Managing Roles.
      • Node Launch Configuration: specify custom data to configure node, that is, to run the configured script when the node is started up. You need to ensure the reentrant and retry logic of the script. The script and its log files can be viewed at the node path: /usr/local/qcloud/tke/userscript.
      • Cordon: after you check Cordon this node, new Pods cannot be scheduled to this node. You can uncordon the node manually, or execute the uncordon command in custom data as needed.
      • Label: click Add to customize the label. The label set here will be automatically added to the initial nodes of the cluster, and is used to filter and manage nodes in the future.
    3. Click Next to configure the component.

    Component configurations

    1. In the Component Configurations step, configure a component based on the following information, as shown below:
      • Addon: you can select the add-ons such as storage, monitor, and image as needed. For more information, see Add-on Overview.
      • Log Service: the cluster auditing is enabled by default. For more information, see Cluster Audit.
    2. Click Next to check and confirm the configuration information.

    Information confirmation

    In the “Confirm Info” page, confirm the selected configuration information and billing mode for the cluster and click Done.

    Viewing the cluster

    You can view clusters that have been created in the cluster list. You can click the cluster ID to enter the details page, and then view the cluster, node, and network information on the “Basic Information” page, as shown below:


    You can also use the CreateCluster API to create a cluster. For more information, see CreateCluster API Documentation.