tencent cloud

Feedback

Creating Native Nodes

Last updated: 2023-05-05 11:05:32
    This document describes how to create native nodes in the Tencent Kubernetes Engine (TKE) console or by using the YAML configuration file.

    Prerequisites

    You have logged in to the TKE console.
    You have created a standard TKE cluster. For more information, see Quickly Creating a Standard Cluster.
    Note
    You can manage native nodes only at the node pool level.

    Using the Console

    1. Log in to the TKE console and select Cluster in the left sidebar.
    2. On the cluster list page, click the ID of the target cluster to go to the details page.
    3. Choose Node management > Node pool in the left sidebar to go to the Node pool list page.
    4. Click Create node pool. On the Create node pool page, set the parameters as shown in the following figure. For more information about the parameters, see Parameters.
    
    5. (Optional) Click More settings to view or configure more settings, as shown in the following figure:
    
    6. Click Create node pool.

    Using YAML

    The following sample code shows the specifications of Kubernetes resources in a native node pool. For more information about the parameters in the YAML configuration file, see Parameters.
    apiVersion: node.tke.cloud.tencent.com/v1beta1
    kind: MachineSet
    spec:
    type: Native
    displayName: mstest
    replicas: 2
    autoRepair: true
    deletePolicy: Random
    healthCheckPolicyName: test-all
    instanceTypes:
    - C3.LARGE8
    subnetIDs:
    - subnet-xxxxxxxx
    - subnet-yyyyyyyy
    scaling:
    createPolicy: ZonePriority
    maxReplicas: 100
    template:
    spec:
    displayName: mtest
    runtimeRootDir: /var/lib/containerd
    unschedulable: false
    metadata:
    labels:
    key1: "val1"
    key2: "val2"
    providerSpec:
    type: Native
    value:
    instanceChargeType: PostpaidByHour
    lifecycle:
    preInit: "echo hello"
    postInit: "echo world"
    management:
    hosts:
    - Hostnames:
    - lkongtest
    IP: 22.22.22.22
    nameservers:
    - 183.60.83.19
    - 183.60.82.98
    - 8.8.8.8
    metadata:
    creationTimestamp: null
    securityGroupIDs:
    - sg-xxxxxxxx
    systemDisk:
    diskSize: 50
    diskType: CloudPremium

    Parameters

    Parameter Module
    Parameter in the Console
    Parameter in YAML
    Description
    Start-up configuration
    Node pool type
    Parameter: spec.type
    Valid value: Native
    Native indicates a native node pool.
    Node pool name
    Parameter: metadata.name
    Example value: demo-machineset
    The node pool name is customizable.
    Billing Mode
    Parameter: spec.template.spec.providerSpec.value.instanceChargeType
    Valid value: PostpaidByHour, which is corresponding to Pay-as-you-go in the console.
    Native nodes support the pay-as-you-go billing mode.
    Model Specification
    Model:
    Parameter: spec.instanceTypes
    Example value: S2.MEDIUM4. For more information about supported specifications, see the Model Specification pop-up window in the console.
    
    System disk:
    Parameter: spec.template.spec.providerSpec.value.systemDisk.diskSize/diskType
    Example values:
    diskSize: Size of the system disk in GB. You can specify a custom value, which must be a multiple of 10. Default value: 50.
    diskType: Type of the system disk. Valid values: CloudPremium and CloudSSD.
    You can specify the model specifications in the Model Specification pop-up window based on the following information:
    Zone: Filters the instances available in the selected zone. For more information, see Regions and Availability Zones.
    Model: Filters instances by the number of CPU cores, memory size, and instance type. System disk: Specifies the storage size and schedules the node operation. We recommend that you set the system disk size to a value larger than 100 GB.
    Security Groups
    Parameter: spec.template.spec.providerSpec.value.securityGroupIDs
    Example value: sg-a7msxxx (ID of the security group)
    The default value is the ID of the security group specified when the cluster is created. You can replace the security group or add a security group as needed.
    Quantity
    Parameter: spec.replicas
    Example value: 7 (The value is customizable).
    You use this parameter to specify the number of nodes to be maintained in the node pool. For example, if you set the value to 5, then five nodes can be maintained in the node pool.
    Container network
    Parameter: spec.subnetIDs
    Example value: subnet-i2ghxxxx (ID of a container subnet)
    Select available subnets as needed.
    1. When you manually adjust the number of nodes, the system tries to create nodes as per the order of the subnets. For example, if the system creates a node on the first subnet in the list, the system creates all other nodes on the first subnet.
    2. If you enable auto-scaling for the node pool, the system selects the appropriate subnets to create nodes based on to the specified scaling policy.
    Ops features
    Fault self-heal
    Parameter: spec.autoRepair
    Valid values: true and false.
    Optional. We recommend that you enable the fault self-heal feature by setting the value to true. This feature detects exceptions of native nodes in real time, such as the OS, runtime, and kubelet exceptions, and takes self-heal actions.
    Self-heal rule
    Parameter: spec.healthCheckPolicyName
    Example value: test-all (name of the bound self-heal rule)
    You can bind a different self-heal rule to each node pool.
    Automatic upgrade
    -
    Optional. This feature is in alpha testing. TKE supports automatic upgrade during the specified Ops window periods to simplify the version Ops, such as the iteration and maintenance of Kubernetes, runtime components, and OS kernel. This feature also timely fix security vulnerabilities based on the Tencent Security intelligence.
    Upgradeable items
    -
    The system will upgrade the version of the specified items. A specific upgrade package is provided for each upgradeable item. We will release the version upgrade notes in the console and documentation at least seven days before the version upgrade.
    Ops windows
    -
    The system automatically upgrades the upgradeable items within the specified Ops window periods.
    Maximum number of upgrade nodes
    -
    Within the Ops windows, the number of upgrade nodes increases exponentially with 2 as the base, starting from 1. The number of nodes that are concurrently upgraded will not exceed the specified maximum number of upgrade nodes.
    Auto Scaling
    Parameter: spec.scaling
    If the auto-scaling feature is enabled, CA automatically scales in or out the node pool.
    Note: The auto-scaling of a native node is implemented by TKE. The auto-scaling of a normal node relies on Auto Scaling (AS).
    Number of Nodes
    Parameter: spec.scaling.maxReplicas / minReplicas
    Example values:
    maxReplicas: 7 (The value indicates the maximum number of nodes and is customizable).
    minReplicas: 2 (The value indicates the minimum number of nodes and is customizable).
    The number of nodes in the node pool cannot exceed the specified range. If auto-scaling is enabled for a node pool, the number of native nodes in the node pool can be automatically adjusted within the specified range.
    Scaling policy
    Parameter: spec.scaling.createPolicy
    Valid values: Zone priority and Zone equality in the console. ZonePriority and ZoneEquality in the YAML configuration file.
    1. If you specify Zone priority, the auto-scaling feature performs scaling in the preferred zone first. If the preferred zone cannot be scaled, other zones are used.
    2. If you specify Zone equality, the auto-scaling feature distributes node instances evenly among the zones, or subnets, specified in the scaling group. This policy takes effect only if you have configured multiple subnets.
    Advanced parameters
    Lables
    Parameter: spec.template.spec.metadata.labels
    Valid values: Custom labels in the key1: "val1" format.
    A node-level attribute for the filtering and easy management of nodes. The specified labels are automatically added to all nodes in the node pool.
    Taints
    Parameter: spec.template.spec.metadata.taints
    Valid values: NoSchedule, PreferNoSchedule, and NoExecute. The value indicates the type of taints.
    A node-level attribute that is often used with Tolerations. You can specify this parameter for a node in the node pool, so as to stop scheduling Pods that do not meet the requirements to the node. The specified type of taints are automatically added to all nodes in the node pool.
    Container directory
    Parameter: spec.template.spec.runtimeRootDir
    Example value: /data/containerd (custom container directory).
    Specify this parameter to set the container and image storage directory. Another example value: /var/lib/.
    Kubelet custom parameter
    This parameter is controlled based on the allowlist. To enable this parameter, submit a ticket or contact Technical Support.
    This parameter allows you specify common Kubelet parameters.
    Management
    Parameter: spec.template.spec.providerSpec.value.management.hosts/nameservers/KernelArgs
    Example values:
    hosts: Hostnames: [ 'test' ], IP: '22.22.22.22'nameservers: [ '183.60.83.19', '183.60.82.98']KernelArgs: This parameter is controlled based on the allowlist. To enable this parameter, submit a ticket.
    Supported Management parameters include Nameservers, Hosts, and KernelArgs.
    Custom scripts
    Parameter: spec.template.spec.providerSpec.value.lifecycle.preInit/postInit
    Example values:
    preInit: "echo hello" (custom script executed before the node initialization).
    postInit: "echo world" (custom script executed after the node initialization).
    Configure the node by specifying custom scripts that are executed before and after the node initialization. You need to ensure the reentrant and retry logic of the scripts. The scripts and their log files can be viewed at the path /usr/local/qcloud/tke/userscript.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support