Uninstall/Reset

k0s can be uninstalled locally with k0s reset command and remotely with k0sctl reset command. They remove all k0s-related files from the host.

reset operates under the assumption that k0s is installed as a service on the host.

Uninstall a k0s node locally

To prevent accidental triggering, k0s reset will not run if the k0s service is running, so you must first stop the service:

  1. Stop the service:

    1. sudo k0s stop
  2. Invoke the reset command:

    1. $ sudo k0s reset
    2. INFO[2021-06-29 13:08:39] * containers steps
    3. INFO[2021-06-29 13:08:44] successfully removed k0s containers!
    4. INFO[2021-06-29 13:08:44] no config file given, using defaults
    5. INFO[2021-06-29 13:08:44] * remove k0s users step:
    6. INFO[2021-06-29 13:08:44] no config file given, using defaults
    7. INFO[2021-06-29 13:08:44] * uninstall service step
    8. INFO[2021-06-29 13:08:44] Uninstalling the k0s service
    9. INFO[2021-06-29 13:08:45] * remove directories step
    10. INFO[2021-06-29 13:08:45] * CNI leftovers cleanup step
    11. INFO k0s cleanup operations done. To ensure a full reset, a node reboot is recommended.

Uninstall a k0s cluster using k0sctl

k0sctl can be used to connect each node and remove all k0s-related files and processes from the hosts.

  1. Invoke k0sctl reset command:

    1. $ k0sctl reset --config k0sctl.yaml
    2. k0sctl v0.9.0 Copyright 2021, k0sctl authors.
    3. ? Going to reset all of the hosts, which will destroy all configuration and data, Are you sure? Yes
    4. INFO ==> Running phase: Connect to hosts
    5. INFO [ssh] 13.53.43.63:22: connected
    6. INFO [ssh] 13.53.218.149:22: connected
    7. INFO ==> Running phase: Detect host operating systems
    8. INFO [ssh] 13.53.43.63:22: is running Ubuntu 20.04.2 LTS
    9. INFO [ssh] 13.53.218.149:22: is running Ubuntu 20.04.2 LTS
    10. INFO ==> Running phase: Prepare hosts
    11. INFO ==> Running phase: Gather k0s facts
    12. INFO [ssh] 13.53.43.63:22: found existing configuration
    13. INFO [ssh] 13.53.43.63:22: is running k0s controller version 1.29.8+k0s.0
    14. INFO [ssh] 13.53.218.149:22: is running k0s worker version 1.29.8+k0s.0
    15. INFO [ssh] 13.53.43.63:22: checking if worker has joined
    16. INFO ==> Running phase: Reset hosts
    17. INFO [ssh] 13.53.43.63:22: stopping k0s
    18. INFO [ssh] 13.53.218.149:22: stopping k0s
    19. INFO [ssh] 13.53.218.149:22: running k0s reset
    20. INFO [ssh] 13.53.43.63:22: running k0s reset
    21. INFO ==> Running phase: Disconnect from hosts
    22. INFO ==> Finished in 8s