Ability to kill all / uninstall k3s just from the binary with an arg/flag
I'd like to propose some means to kill all k3s and its associated processes and uninstall similar to what we provide in curl install script (today, the curl install script itself creates the necessary k3s-killall.sh and k3s-uninstall.sh scripts)
Use case: I'm just running the k3s binary such as to join an agent to a server. I can kill the k3s process but everything is left behind. There is no easy way for me to kill all. I can't uninstall files created too just with the binary. The issue is that basically I can't really do much with just the binary; I have to install via the curl script to get my killall and uninstall scripts.
I'm not sure how we want to handle this - maybe there is a "reset" argument or something in the k3s binary to do something like killing all and uninstalling. We need some solution.
Note: When we implement this, docs also need to be updated.
Hi, people.
I don't know if it can be useful, but I'm using a script made by myself. It allows to start, stop (I'm running K3s on my laptop for dev/test purposes), and reset (I need a lot of times to give it a fresh start). This script works only with K3s installed as a systemd service, but it can be improved a lot to fit other needs. Maybe it's a good starting point.
This is it: https://gitlab.com/tooling2/k3s-boot
Feel free to fork it if you wish.
@juanmatias I am already using your k3s-boot.sh script and it is very useful. When I do k3s-boot.sh stop it stops the systemd service but the containers are left behind. I don't know if that is a consequence of me using k3s with the docker backend. If I do docker ps after stopping k3s I can still see all pods' containers running.
There should be a k3s subcommand that stops k3s. Something as simple as k3s shutdown would seem apprpriate for this. Or stopping the systemd service should cause a clean shutdown.
so when the server is installed through the binary and there is no k3s-uninstall-script.sh,
after stopping with sudo pkill -9 -f k3s
to uninstall is it sufficient to run:
sudo rm -rf /var/lib/rancher /etc/rancher ~/.kube?
I also had to:
manually umount everything that contained "k3s" or "kubelet" in its path
- rm -fr /var/run/k3s /var/lib/kubelet /run/flannel
- rm the k3s binary
- manually remove A LOT of iptables rules