Node scenarios
Node scenarios#
Before acting on a host, mkectl inspects its current state to determine
whether k0s is installed and running, whether the node is part of this or
another cluster, and whether the node is registered and healthy in the
Kubernetes API. Based on this, a determination is made as to whether to proceed
with the operation, skip the host, or fail with an error.
The table below covers all supported scenarios. The "CA fingerprint match" column group from the design is split into "Part of this cluster" and "Part of any cluster". Membership is detected by comparing the cluster CA fingerprint found on the host against the one from the current cluster.
| ID | Scenario | k0s installed | k0s healthy | Part of this cluster | Part of any cluster | Node registered in cluster | Node ready | node add action | node remove action |
|---|---|---|---|---|---|---|---|---|---|
| 0 | Clean host with k0s binary installed | Yes | No (not running, no service installed) | No (Error 'no traces of cluster CA' is ignored) | No (Error 'no traces of cluster CA' is ignored) | No (not checked) | - | happy path | k0s reset (best effort) |
| 1 | Clean host | No | - | No (check is skipped since k0s is not installed) | No (check is skipped since k0s is not installed) | No (not checked) | - | happy path | report, only de-register from MKEConfig |
| 2 | k0s Installed, part of this cluster, node ready |
Yes | Yes | Yes | Yes | Yes | Yes | report, only register in MKEConfig | happy path |
| 3 | k0s Installed, part of this cluster, node NOT ready | Yes | Yes | Yes | Yes | Yes | No | exclude from adding, but wait readiness | happy path |
| 4 | k0s Installed, part of this cluster, node is NOT registered | Yes | Yes | Yes | Yes | No | - | restart k0sworker service, wait node readiness | report, k0s reset (best effort) |
| 5 | k0s Installed, NOT part of this cluster, but part of other cluster | Yes | Yes | No | Yes | Doesn't matter | Doesn't matter | report, fail | report, fail |
| 6 | k0s installation corrupted, part of this cluster, node registered in cluster | Yes | No | Yes | Yes | Yes | No (can't be ready) | report, fail | k0s reset (best effort) + node removal |
| 7 | k0s installation corrupted, part of this cluster, node not registered in cluster | Yes | No | Yes | Yes | No | - | report, fail | k0s reset (best effort) |
| 8 | k0s installation corrupted, NOT part of this cluster | Yes | No | No | Yes | Doesn't matter | Doesn't matter | report, fail | report, fail |
| 9 | k0s installation corrupted, NOT part of ANY cluster | Yes | No (either not running or no service installed) | Can't detect (Error: no traces of cluster CA) | Can't detect (Error: no traces of cluster CA) | Doesn't matter | Doesn't matter | report, fail | report, fail |
| 10 | k0s is not installed, part of this cluster | No | - | Yes | Yes | Doesn't matter | Doesn't matter | report, fail (need manual cleanup) | clean-up folders (k0s reset leftovers + node removal) |