18

Is there any way to access local docker images directly (without using 'docker save') with k3s?

Like minikube accesses local docker images after running this command

eval $(minikube docker-env)

A little bit of background.

I have set up a machine using Ubuntu 19.04 as 'master' and raspberry pi as 'worker' using k3s. Now, I want to use a local image to create a deployment on the worker node.

Update

Adding screenshot as said in the comment below.

Screenshot for the image listings

enter image description here

mpromonet
  • 10,379
  • 42
  • 54
  • 85
Naveed
  • 181
  • 1
  • 6

1 Answers1

11

You can start k3s like this sudo k3s server --docker which will use host's Docker rather than containerd. This will make all local images available to k3s and if your ImagePullPolicy is IfNotPresent k3s will use it rather than trying to pull it.

foobarto
  • 474
  • 4
  • 5
  • On Arch I tried that. So I edited /usr/lib/systemd/system/k3s.service, adding the ` --docker` : `ExecStart=/usr/bin/k3s server --docker`. `sudo systemctl daemon-reload` `sudo systemctl restart k3s.service`. When I did kubectl, it may no longer work correctly, sometimes seemingly doing the command, but always printing `The connection to the server 127.0.0.1:6443 was refused - did you specify the right host or port?` or `Error from server (InternalError): an error on the server ("apiserver not ready") has prevented the request from succeeding (get pods)`. I guess crashing. – Attila123 Feb 05 '22 at 15:00