enix / kube-image-keeper

kuik is a container image caching system for Kubernetes
MIT License
443 stars 32 forks source link

Pull images that needs cached from Kubernetes nodes (images cached by CRI) instead of pulling images from remote registry. #404

Open sivarama-p-raju opened 4 weeks ago

sivarama-p-raju commented 4 weeks ago

Hi Team,

First of all, thanks a lot for "kube-image-keeper". It is a great project and solves many problems for me.

I would like to request for a feature, which could help the project.

When images need cached to the "kube-image-keeper's registry, the images are pulled from remote image registry.

Would it be possible to query the local cache on the nodes first to check if they already have the image ? If they do, then the image could be pulled from there instead of the remote registry.

We have a use-case where we only save 10 tags of a repository on our remote registry. However, one or more of our kubernetes clusters could be running a deployment using an image tag that is no longer present in the remote registry.

In such a case, the caching fails since it is not present on the remote registry:

$ kubectl get cachedimages
NAME                                                                STATUS         CACHED   RETAIN   EXPIRES AT   PODS COUNT   AGE
<repository>-<tag>                                                 ErrImagePull                                       6        95m

Since the image with the needed tag is already cached on at least one of the nodes in the cluster, it would make sense to pull it from there.

This could also help reduce the traffic with the remote registry for all the image pulls.

Could you please review and let me know your thoughts on the same ?

Thanks and regards, Sivarama Raju P

sivarama-p-raju commented 2 weeks ago

Hi Team,

Could you please let me know if you have any thoughts regarding my idea ?

Thanks in advance.