Is there any way to cache loaded images on Kubernetes

10/20/2018

I load an image (.tar) into local docker repository and then Kubernetes pulls that Image into a container. After the application is up and running I want to remove that image from local docker repository, is that right way or Kubernetes still needs that image inside docker local repository? I have tested when deleting that image, my Application still works, but if I want to scale up or scale down, I got a problem because the image is missing.

I presume, if the Pod goes down, Kubernetes will seek for Image again in docker repository?

Is there any way to cache that Image inside Kubernetes, so no need to pull again from docker repository?

The reason why I want to delete these images right after Application run on Kubernetes is security, I don't want to leave my images inside docker repository so a user can't extract that image and export it somewhere...

-- Dino
docker
kubernetes

1 Answer

10/20/2018

I presume, if the Pod goes down, Kubernetes will seek for Image again in docker repository?

Yes.

Is there any way to cache that Image inside Kubernetes, so no need to pull again from docker repository?

When you pull an image it's cached locally by docker or your runtime manager.

The reason why I want to delete these images right after Application run on Kubernetes is security, I don't want to leave my images inside docker repository so a user can't extract that image and export it somewhere...

If you are concerned about security you shouldn't put sensitive information in the image (passwords, credentials, keys). That's why there are Kubernetes Secrets or tools like Hashicorp Vault.

If you are concerned about keeping intellectual property private you should consider using a private container image repository or private Docker registry

-- Rico
Source: StackOverflow