You can add existing Elastic Compute Service (ECS) instances to a Kubernetes cluster. Kubernetes clusters only support adding worker nodes.

Prerequisites

  • If you have not created a cluster before, create a cluster first. For how to create a cluster, see Create a Kubernetes cluster.
  • Add the ECS instance to the security group of the Kubernetes cluster.

Background information

  • By default, each cluster can contain up to 40 nodes. To add more nodes, open a ticket.
  • The ECS instance to be added must be in the same Virtual Private Cloud (VPC) region as the cluster.
  • When adding an existing instance, make sure that your instance has an Elastic IP (EIP) for the VPC network type, or the corresponding VPC is already configured with the NAT gateway. In short, make sure the corresponding node can access public network normally. Otherwise, the ECS instance fails to be added.
  • The ECS instance to be added must be under the same account as the cluster.
  • Only the ECS instance whose operating system is CentOS can be added.

Procedure

  1. Log on to the Container Service console.
  2. In the left-side navigation pane under Container Service-Kubernetes, choose Clusters > Clusters.
  3. Select the target cluster and click More > Add Existing Node.

    The Add Existing ECS Instance page appears. All the available ECS instances under the current account are displayed on this page. Select to add existing ECS instances automatically or manually.

    If Automatically Add is selected, select the ECS instances to add them to the cluster automatically. If Manually Add is selected, you must obtain the command and then log on to the corresponding ECS instance to add the ECS instance to this cluster. You can only add one ECS instance at a time.



  4. Select Auto to add multiple ECS instances at a time.
    1. In the list of existing cloud servers, select the target ECS instance, and then click Next Step.


    2. Set the password used to log on to the ECS instance, add tags to the ECS instance, and then click Next Step.


    3. Click Confirm in the displayed dialog box. The selected ECS instances are automatically added to this cluster.


  5. Optional: You can also select Manual to manually add an existing ECS instance to the cluster.
    1. Select the ECS instance to be added and then click Next Step. You can add only one ECS instance at a time.


    2. Confirm the information and then click Next Step.


    3. Copy the command.


    4. Click Done.
    5. Log on to the ECS console and click Instances in the left-side navigation pane. Select the region in which the cluster resides and the ECS instance to be added.
    6. Click Connect at the right of the ECS instance to be added. The Enter VNC Password dialog box appears. Enter the VNC password and then click OK. Enter the copied command and then click OK to run the script.


    7. After the script is successfully run, the ECS instance is added to the cluster. You can click the cluster ID on the Cluster List page to view the node list of the cluster and check if the ECS instance is successfully added to the cluster.