Reinstall a node

k0sctl currently does not support changing all the configuration of containerd (state, root) on the fly.

For example, in order to move containerd’s root directory to a new partition/drive, you have to provide --data-dir /new/drive in your k0sctl installFlags for each (worker) node. --data-dir is an option of k0s and then added to the service unit.

The following is an example of that:

  1. # spec.hosts[*].installFlags
  2. - role: worker
  3. installFlags:
  4. - --profile flatcar
  5. - --enable-cloud-provider
  6. - --data-dir /new/drive
  7. - --kubelet-extra-args="--cloud-provider=external"

However, the installFlags are only used when the node is installed.

Steps

Drain the node:

  1. kubectl drain node.hostname

Access your node (e.g. via ssh) to stop and reset k0s:

  1. sudo k0s stop
  2. sudo k0s reset

Reboot the node (for good measure):

  1. sudo systemctl reboot

Once the node is available again, run k0sctl apply to integrate it into your cluster and uncordon the node to allow pods to be scheduled:

  1. k0sctl apply -c config.yaml
  2. kubectl uncordon node.hostname