Skip to content

mkectl node add

mkectl node add#

Add one or more worker nodes to an existing MKE cluster.

Synopsis#

The operation bootstraps k0s on each target node, joins it to the cluster, and updates the MKEConfig in cluster. The command is idempotent - if run against the list of hosts that already joined to the cluster - no-op.

Prerequisites: 1. The cluster must be in a stable state (no upgrade, apply, or reset in progress).

  1. Hosts that are to be added to the cluster must not be a member of any k8s cluster except of the current. No active operations (adding/removing to/from cluster) are executed on the hosts.
mkectl node add [flags]

Examples#

# Add nodes defined in hosts.yaml
mkectl node add --hosts-path hosts.yaml

# Add nodes with a custom total timeout
mkectl node add --hosts-path hosts.yaml --timeout-minutes 20

# Add nodes with a custom node readiness timeout
mkectl node add --hosts-path hosts.yaml --readiness-timeout-minutes 5

# Overwrite the controller's SSH key from the MKEConfig with an SSH key from a local file
mkectl node add --hosts-path hosts.yaml --ssh-key ~/.ssh/prod-key.pem

# Overwrite the bastion node SSH key from the MKEConfig with an SSH key from a local file
mkectl node add --hosts-path hosts.yaml --ssh-key ~/.ssh/node-key.pem --bastion-ssh-key ~/.ssh/bastion-key.pem

Host config file format:

hosts:
  - role: worker
    installFlags: # optional
      - "--profile=custom-profile"
    ssh:
      address: 10.0.1.15
      user: root
      keyPath: ~/.ssh/key.pem
      port: 22
      bastion: # optional
        address: 1.2.3.4
        user: root
        keyPath: ~/.ssh/bastion-key.pem
        port: 22

Options#

  -h, --help                            help for add
      --readiness-timeout-minutes int   Specify how long to wait for new nodes to become 'Ready' (condition Ready == true). Timeout should be less than total timeout for operation. If 0, then wait indefinitely. (default 3)

Options inherited from parent commands#

      --bastion-ssh-key string           Specify the ssh key file for bastion host to be used to connect to existing cluster's controller host
                                         (when MKEConfig specifies one for that controller). Controller is picked from MKEConfig as first entry 
                                         with configured SSH. Same precedence and scope as --ssh-key. Has no effect when the chosen controller
                                         has no bastion configured in MKEConfig.
                                         Does NOT override the per-worker bastion key in hosts.yaml.
      --collect-facts-timeout duration   Timeout for the collect-facts phase (gathering per-host facts such as cgroup version over SSH) (default 5m0s)
      --concurrency int                  Maximum number of nodes to configure in parallel, set to 0 for unlimited (default 30)
      --dry-run                          Simulate the node operations without making any changes
  -f, --file string                      path to the config file. Not needed for restore where config is loaded from the backup (default "mke4.yaml")
      --force                            Bypass user confirmations. This will apply changes without any confirmations
      --hosts-path string                path to the hosts config file (default "hosts.yaml")
      --kubeconfig string                path to the kubeconfig file of the existing or restored cluster. DO NOT USE when creating a new cluster (default "/home/runner/.mke/mke.kubeconf")
      --lease-adopt-stale                if true, matching stale lease would be adopted instead of failing with error
      --lease-renew-interval duration    lease renew interval for cluster-wide/node operations, should be < leaseTTL (default 20s)
      --lease-ttl duration               lease TTL for cluster-wide/node operations (default 1m0s)
  -l, --logLevel string                  specify a log level (info, warn, debug, trace, error) (default "info")
      --no-color                         when provided, disables colored output
      --no-pretty-print                  when provided, disables pretty print output formatting
      --ssh-key string                   Specify the ssh key file to be used to connect to existing cluster's controller host. Controller is picked from 
                                         MKEConfig as first entry with configured SSH. If specified, overrides the keyPath stored in MKEConfig 
                                         for that controller; the file must exist locally. Required when MKEConfig's controller keyPath is empty
                                         or not present on this machine.
                                         Does NOT affect SSH keys for the new workers being added — those come from hosts.yaml only.
      --timeout-minutes int              Use specified timeout (in minutes) for node operations. If 0, then wait indefinitely. (default 60)
      --version version[=true]           --version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version