k8s: make local image accessible for k8s

1/28/2020

I've just installed a k8s cluster (k3d).

I'm just playing with that and I'm running against the first newbie issue: How to load our local created images.

I mean, I've just created a docker image tagged as quarkus/feedly:v1.

  1. How could I make it accessible for k8s cluster?
  2. Which is the default k8s container runtime?
  3. Does exist any interaction with my k8s cluster and my local docker? I mean, Have each k8s node installed a docker/rkt/containerd runtime?
  4. Could I create a docker registry inside kubernetes, as a manifest? How could I make that kubernetes make access to it?

I've deployed my manifest and I'm getting these events:

Failed to pull image "quarkus/feedly:0.0.1-SNAPSHOT": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/quarkus/feedly:0.0.1-SNAPSHOT": failed to resolve reference "docker.io/quarkus/feedly:0.0.1-SNAPSHOT": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

I know it's a normal error since quarkus registry doesn't exist.

Any helping code over there?

-- Jordi
docker
k3s
kubernetes

1 Answer

1/28/2020

Here are some pointers :

  1. To make your image accessible through your k8s cluster, you need to use a registry that is accessible from your cluster node. So either, create an account on the docker hub and use this one, or install a local image registry and use it.
  2. Docker is the default container runtime used by a majority of k8s distribution. However, you can use any OCI compatible runtime (containerd for example). rkt is no longer a living project, so i advise not to use it.
  3. Well, it depends on the k8s distribution you're using. Anyway, each nodes on the cluster need a container runtime installed on it. It is mandatory.
  4. Deploying a Docker registry as a kubernetes resource is probably not a good idea, as you'll have to much configuration to make it work. However, the best solution is to deploy a docker registry inside one of your node and then call it using the node IP. You have a configuration example in the official doc. By the way, Docker provide a registry as a Docker image, so the installation is pretty simple.

Hope this helps !

-- Marc ABOUCHACRA
Source: StackOverflow