Hi,
I am just wondering where to delete container images pulled by microk8s?
Hi @linxuyalun
MicroK8s packages containerd and this is where images are pulled in. To inspect what images are available you can:
microk8s.ctr -n k8s.io images list
With --help you can see the that there is a remove option:
> microk8s.ctr -n k8s.io images --help
NAME:
ctr images - manage images
USAGE:
ctr images command [command options] [arguments...]
COMMANDS:
check check that an image has all content available locally
export export an image
import import images
list, ls list images known to containerd
pull pull an image from a remote
push push an image to a remote
remove, rm remove one or more images by reference
label set and clear labels for an image
OPTIONS:
--help, -h show help
You may also want to take a look at https://microk8s.io/docs/working where we describe how to work with images/registries and this comment https://github.com/ubuntu/microk8s/issues/382#issuecomment-488229576 describing how to remove an image from the local registry.
Oh, thanks!
That's what I need
Is there any option to remove all of the images ?
Is there any option to remove all of the images ?
@adharshmk96, you may want to look at https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/
Is there any option to remove all of the images ?
@adharshmk96, you may want to look at https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/
@ktsakalozos , I couldn't understand. I'm very new to this stuff.. if you don't mind I'd like some guidance
Sure, kubelet periodically tries to free up the space occupied by images that are not in use (garbage collection). You can configure kubelet to be more or less aggressive via the configuration arguments shown in [1, 2].
You can edit the file /var/snap/microk8s/current/args/kubelet to configure the garbage collection based on your needs. After editing the kubelet args file you will need to restart MicroK8s with microk8s.stop; microk8s.start.
[1] https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/
[2] https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/
Most helpful comment
Hi @linxuyalun
MicroK8s packages containerd and this is where images are pulled in. To inspect what images are available you can:
With
--helpyou can see the that there is a remove option:You may also want to take a look at https://microk8s.io/docs/working where we describe how to work with images/registries and this comment https://github.com/ubuntu/microk8s/issues/382#issuecomment-488229576 describing how to remove an image from the local registry.