MicroK8s images prune utility for production servers

For those that are using microk8s for production, you could be interested in a prune utility that would remove images unused by current containers (like docker system prune). The microk8s ctr utility do not provide such feature.

My experience is that images are quickly stacking and I am not sure any garbage collector is taking care of that.

If you need one, check GitHub - philippelt/microk8s_prune: Containerd prune utility to cleanup loaded but unused images. This utility is targeting microk8s release but can easily be adapted to any containerd installation.

If you are aware of alternative methods, all suggestions are welcomeā€¦

2 Likes

Sorry for being late, but for folks in the future Iā€™ll leave this suggestion:

  • install crictl on each node from The docs
  • run crictl -r unix:///var/snap/microk8s/common/run/containerd.sock rmi --prune
    Maybe add this to a cron taskā€¦
2 Likes

Franco_Martin has the right answer. Thank you! I have successfully recovered about 500GB of storage on my cluster thanks to this answer.