k0s reset

k0s Command-Line interface allows users to remove all k0s related files from the host.

The reset command operates under the assumption that k0s is installed as a service on the host. To prevent accidental triggering, it will not run if the k0s service is running. So first, we need to stop the service:

For controller nodes:

  1. $ systemctl stop k0scontroller

If the service is not stopped k0s will return an error message:

  1. $ k0s reset
  2. FATA k0s seems to be running! please stop k0s before reset.

If k0s has been stopped, the reset operation will proceed:

  1. $ k0s reset
  2. INFO[2021-02-25 15:58:41] Uninstalling the k0s service
  3. INFO[2021-02-25 15:58:42] no config file given, using defaults
  4. INFO[2021-02-25 15:58:42] deleting user: etcd
  5. INFO[2021-02-25 15:58:42] deleting user: kube-apiserver
  6. INFO[2021-02-25 15:58:42] deleting user: konnectivity-server
  7. INFO[2021-02-25 15:58:42] deleting user: kube-scheduler
  8. INFO[2021-02-25 15:58:42] starting containerd for cleanup operations...
  9. INFO[2021-02-25 15:58:42] containerd succesfully started
  10. INFO[2021-02-25 15:58:42] attempting to clean up kubelet volumes...
  11. INFO[2021-02-25 15:58:42] successfully removed kubelet mounts!
  12. INFO[2021-02-25 15:58:42] attempting to clean up network namespaces...
  13. INFO[2021-02-25 15:58:42] successfully removed network namespaces!
  14. INFO[2021-02-25 15:58:42] attempting to stop containers...
  15. INFO[2021-02-25 15:58:49] successfully removed k0s containers!
  16. INFO[2021-02-25 15:58:49] deleting k0s generated data-dir (/var/lib/k0s) and run-dir (/run/k0s)
  17. ERRO[2021-02-25 15:58:50] k0s cleanup operations done. To ensure a full reset, a node reboot is recommended.