Manually deleting unused Images on kubernetes (GKE)

7/18/2018

I am running a managed kubernetes cluster on Google Cloud Platform with a single node for development.

However when I update Pod images too frequently, the ImagePull step fails due to insufficient disk space in the boot disk.

I noticed that images should be auto GC-ed according to documentation, but I have no idea what is the setting on GKE or how to change it.

https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/#image-collection

  1. Can I manually trigger a unused image clean up, using kubectl or Google Cloud console command?
  2. How do I check/change the above GC setting above such that I wont encounter this issue in the future?
-- William Chong
docker
google-cloud-platform
google-kubernetes-engine
kubectl
kubernetes

1 Answer

7/19/2018

Since Garbage Collector is an automated service, there are no kubectl commands or any other commands within GCP to manually trigger Garbage Collector.

In regards to your second inquiry, Garbage Collector is handled by the Master node. The Master node is not accessible to users since it is a managed service. As such, users cannot configure Garbage Collection withing GKE.

The only workaround I can offer is to create a custom cluster from scratch within Google Compute Engine. This would provide you access to the Master node of your cluster so you can have the flexibility of configuring the cluster to your liking.

Edit: If you need to delete old images, I would suggest removing the old images using docker commands. I have attached a github article that provides several different commands that you can run on the node level to remove old images here.

-- Jason
Source: StackOverflow