I attempted to remove the microk8s snap, and it hung on Save data of snap "microk8s" in automatic snapshot set. After investigating a bit, it looks like microk8s.reset doesn't clean up volumes, and I had many of them left over:
$ sudo du -sh /var/snap/microk8s/common/
37G /var/snap/microk8s/common/
With paths like this: /var/snap/microk8s/common/default-storage/kubeflow-database-a6dbbcb2-mariadb-0-pvc-a75a4c3b-6b61-11e9-bf3c-e86a6466b483/
After running sudo rm -rf /var/snap/microk8s/common/*, removing the microk8s snap worked great.
@knkski this is somewhat expected. We are not removing persistent volumes unless you do a microk8s.disable storage and answer "Yes" to the respective question. The reasn for not cleaning up persistent volumes without confirmation is that you may have some data you may want to keep. Having said that, we may want to have a flag on the microk8s.reset to clean persistent volumes as well. What do you think?
@ktsakalozos: A flag on microk8s.reset sounds perfect. For comparison, juju has a --destroy-storage on kill-controller that does the same thing
I am facing this issue as well, I think it would be nice for a warning to show up here .e.g.
Save data of snap "microk8s" in automatic snapshot set #2
WARN: persistent data exists in /var/snap/microk8s/common/, run microk8s.disable storage to remove
@ktsakalozos: I tried disabling storage (after having just done a microk8s.reset), and got this:
$ microk8s.disable storage
Disabling default storage
storageclass.storage.k8s.io "microk8s-hostpath" deleted
Error from server (NotFound): error when deleting "/home/knkski/snap/microk8s/522/tmp/temp.storage.yaml": deployments.extensions "hostpath-provisioner" not found
Failed to disable storage
Did you microk8s.disable storage after a microk8s.reset?
Could you do a microk8s.enable storage and then a microk8s.disable storage? I suspect the microk8s.reset removed the storage daemon resulting in the error you got.
@ktsakalozos: Looks like microk8s.enable storage, then microk8s.disable storage worked, thanks! Do you think it would make sense to open a new bug for adding in some output like this?
Failed to disable storage, is the storage daemon running? You may need to run `microk8s.enable storage` first.
open a new bug for adding in some output
Yes, that would be a great entry level patch! Go ahead with creating an issue with the suggested improvement.
I guess this issue can be closed since release of v1.16.0 (920) ?
microk8s.reset --destroy-storage
du -csh /var/snap/microk8s/common/*
40K /var/snap/microk8s/common/run
176M /var/snap/microk8s/common/var
176M total
Relate-to: https://github.com/ubuntu/microk8s/pull/616
Yes, thank you @rzr
Most helpful comment
I guess this issue can be closed since release of v1.16.0 (920) ?
Relate-to: https://github.com/ubuntu/microk8s/pull/616