-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preload a docker image on the k3s node agents #141
Conversation
Confirmed that this version is working for my use case in #92 |
Does this work with compressed archives too? Just curious. |
pkg/agent/containerd/containerd.go
Outdated
@@ -122,5 +127,41 @@ func Run(ctx context.Context, cfg *config.Node) error { | |||
} | |||
} | |||
|
|||
imageDir := "/var/lib/rancher/k3s/agent/images" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a new struct field, cfg.Containerd.Images
which is the path to the images and then setup the real path in pkg/agent/config/config.go run(...)
pkg/agent/containerd/containerd.go
Outdated
for _, fileInfo := range fileInfos { | ||
if !fileInfo.IsDir() { | ||
filePath := filepath.Join(imageDir, fileInfo.Name()) | ||
fileContent, err := ioutil.ReadFile(filePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to cause memory issues because you are reading the whole thing into memory (could be gigabytes). Can you just open the file and pass that to import?
Have not tried yet. Also, I have a strange issue: when using this image only for worker nodes, coredns never starts. Trying to work from latest v0.2.0-rc2 to provide a reproducible use case. |
@dduportal Sorry v0.2.0-rc2 is not working. I deleted the tag because it completely fails to start. So master is basically broken. I'm trying to fix now. Also need better CI :/ |
Master is fixed and v0.2.0-rc3 is released which is stable again. |
I think that the |
@juliens That's fine. We can add support for compression later. I left just one more small comment, if you can address that I'll merge and do a build with this in it. |
Co-Authored-By: juliens <[email protected]>
@juliens This should be in v0.2.0-rc4 now if you could please validate the build that would be great! |
We (the Traefik team: @juliens, @dduportal and me) will validate if the k3s-inator 😄 works well tomorrow morning (it's 2am for us). |
It works perfectly. Thanks ;) 👏 |
Confirmed here also: works like a charm (v0.2.0-rc4 with image preloading). |
I have added images which I exported with I get the following error.
This should work right? |
Hi, I just used this feature today. It looks like an image tagged as
This can be observed through this command:
|
This PR adds preloading existing container images (
docker save
format ) from/var/lib/rancher/k3s/agent/images
Fixes #92