Skip to main content
Version: v1.3.x

Manual Removal

Create an ImageList and specify the images you would like to remove. In this case, the image will be removed.

cat <<EOF | kubectl apply -f -
kind: ImageList
name: imagelist
- # use "*" for all non-running images

ImageList is a cluster-scoped resource and must be called imagelist. "*" can be specified to remove all non-running images instead of individual images.

Creating an ImageList should trigger an ImageJob that will deploy Eraser pods on every node to perform the removal given the list of images.

$ kubectl get pods -n eraser-system
eraser-system eraser-controller-manager-55d54c4fb6-dcglq 1/1 Running 0 9m8s
eraser-system eraser-kind-control-plane 1/1 Running 0 11s
eraser-system eraser-kind-worker 1/1 Running 0 11s
eraser-system eraser-kind-worker2 1/1 Running 0 11s

Pods will run to completion and the images will be removed.

$ kubectl get pods -n eraser-system
eraser-system eraser-controller-manager-6d6d5594d4-phl2q 1/1 Running 0 4m16s
eraser-system eraser-kind-control-plane 0/1 Completed 0 22s
eraser-system eraser-kind-worker 0/1 Completed 0 22s
eraser-system eraser-kind-worker2 0/1 Completed 0 22s

The ImageList custom resource status field will contain the status of the last job. The success and failure counts indicate the number of nodes the Eraser agent was run on.

$ kubectl describe ImageList imagelist
Failed: 0
Success: 3
Timestamp: 2022-02-25T23:41:55Z

Verify the unused images are removed.

$ docker exec kind-worker ctr -n images list | grep alpine

If the image has been successfully removed, there will be no output.