Best practices for storing images locally to avoid problems when the image source is down (security too)?

5/20/2020

I'm using argocd and helm charts to deploy multiple applications in a cluster. My cluster happens to be on bare metal, but I don't think that matters for this question. Also, sorry, this is probably a pretty basic question.

I ran into a problem yesterday where one of the remote image sources used by one of my helm charts was down. This brought me to a halt because I couldn't stand up one of the main services for my cluster without that image and I didn't have a local copy of it.

So, my question is, what would you consider to be best practice for storing images locally to avoid this kind of problem? Can I store charts and images locally once I've pulled them for the first time so that I don't have to always rely on third parties? Is there a way to set up a pass-through cache for helm charts and docker images?

-- Vorticity
kubernetes
kubernetes-helm

2 Answers

5/27/2020

If your scheduled pods were unable to start on a specific node with an Failed to pull image "your.docker.repo/image" error, you should consider having these images already downloaded on the nodes.

Think of how you can docker pull the images on your nodes. It may be a linux cronjob, kubernetes operator or any other solution that will ensure presence of docker image on the node even if you have connectivity issues.

-- edbighead
Source: StackOverflow

5/29/2020

As one of the options:

  1. Create your own helm chart repository to store helm charts locally (optionally)
  2. Create local image registry and push there needed images, also tag them accordingly for future simplicity
  3. On each node add insecure registry by editing /etc/docker/daemon.json and adding

    { "insecure-registries" : ["myregistrydomain.com:5000"] }

  4. restart docker service on each node to apply changes

  5. change your helm charts templates, set proper image path from local repo

  6. recreate chart with new properties, (optionally)push chart to created in step 1 local helm repo
  7. FInally install the chart - this time it should pick up images from local repo.

You may also be interested in Kubernetes-Helm Charts pointing to a local docker image

-- VKR
Source: StackOverflow