Skip to content

Add worker nodes#

The mkectl node add command bootstraps k0s on each target node, joins it to the cluster, and updates the MkeConfig stored in the cluster to include the new node.

Note

The mkectl node add command is idempotent, and thus running it against hosts that have already joined the cluster is a no-op.

Command action sequence#

The worker node addition sequence for each host in the hosts.yaml confguration file is as follows:

  1. Reachability check.

    mkectl verifies SSH connectivity to the target host and to the cluster controller.

  2. Cluster state check.

    The mkectl node add command aborts if the cluster is not stable. All cluster nodes that are not currently in a transitioning state must be in Ready state.

  3. Components version check.

    The command aborts if the mKE 4 cluster was deployed with a different mkectl binary or if the cluster runs a different k0s version than the version that mkectl supports.

  4. Node state lock.

    The node is marked as adding to prevent concurrent operations from targeting the same node.

  5. Host state detection.

    mkectl inspects the host to determine the path to take. For the full matrix, refer to Node scenarios.

  6. Worker bootstrap.

    k0s is installed and configured on the node, which then joins the MKE 4 cluster.

  7. Verification.

    mkectl waits for the node to appear in the cluster and reach Ready state within the amount set by the --readiness-timeout-minutes flag.

  8. Cluster config patch.

    The MkeConfig stored in the cluster is updated to include the new node.

Upon failure, the node state lock is cleared. In this event, as the operation is idempotent, it is recommended that you retry the command. If the operation continues to fail, manually clean up the node and rerun the mkectl node add command again.

Examples: mkectl node add#

Command example Description
mkectl node add --hosts-path hosts.yaml Add nodes defined in hosts.yaml.
mkectl node add --hosts-path hosts.yaml --timeout-minutes 20 Add nodes with a custom total timeout of 20 minutes.
mkectl node add --hosts-path hosts.yaml\
    --readiness-timeout-minutes 5
Add nodes with a custom node readiness timeout of 5 minutes.
mkectl node add --hosts-path hosts.yaml --ssh-key ~/.ssh/prod-key.pem Add nodes using an SSH key to connect to the cluster controller.
mkectl node add --hosts-path hosts.yaml\
    --ssh-key ~/.ssh/node-key.pem \
    --bastion-ssh-key ~/.ssh/bastion-key.pem
Add nodes when the controller is behind a bastion host.