This message was deleted.
# k3s
a
This message was deleted.
c
sounds like you figured it out!
g
I did not. The command from the doc does not seem right and I still can't start a pod from an image uploaded to the embedded registry.
c
it sounded like you figured out the correct command to run? crictl image load vs crictl import?
note that there is a difference between load and import. They work on different kinds of files.
g
It did seem to work yes, but I wondered if the fact that it was different from the docs meant that something was wrong with my setup.
c
docker export -> cricl image import > Export a container’s filesystem as a tar archive docker save -> crictl image load > Save one or more images to a tar archive (streamed to STDOUT by default)
are you sure you’re doing the right one?
you PROBABLY want save/load
g
Oh, I see. So it may have worked but the image could be imported the wrong way
c
well it depends on what you did to get the tarball 🙃
I don’t know how you generated your file
g
I definitely used
docker save
c
then you want to load it instead of importing it
g
But I seem to remember that load was not working, even when adding "image" before it
I can try to confirm that
c
let me go refresh my own memory
maybe import does both. There have been some changes I think.
g
Load does not seem to exist, at least from the help doc in my version:
Copy code
# ctr image
NAME:
   ctr images - Manage images

USAGE:
   ctr images command [command options] [arguments...]

COMMANDS:
   check                    Check existing images to ensure all content is available locally
   export                   Export images
   import                   Import images
   list, ls                 List images known to containerd
   mount                    Mount an image to a target path
   unmount                  Unmount the image from the target
   pull                     Pull an image from a remote
   push                     Push an image to a remote
   prune                    Remove unused images
   delete, del, remove, rm  Remove one or more images by reference
   tag                      Tag an image
   label                    Set and clear labels for an image
   convert                  Convert an image
   usage                    Display usage of snapshots for a given image ref

OPTIONS:
   --help, -h  show help
c
Copy code
brandond@dev01:~$ docker save <http://docker.io/library/alpine:3.19|docker.io/library/alpine:3.19> -o alpine.tar
brandond@dev01:~$ file alpine.tar
alpine.tar: POSIX tar archive
brandond@dev01:~$ ls -la alpine.tar
-rw------- 1 brandond brandond 7676416 Feb  2 22:12 alpine.tar

/ # ctr -n <http://k8s.io|k8s.io> image import alpine.tar
unpacking <http://docker.io/library/alpine:3.19|docker.io/library/alpine:3.19> (sha256:566e5c90dcb6624dfce1239f9a7a2431dd9a32d84d2e9e7396efed313d637537)...done

/ # crictl image ls
IMAGE                                        TAG                    IMAGE ID            SIZE
<http://docker.io/library/alpine|docker.io/library/alpine>                     3.19                   05455a08881ea       7.67MB
<http://docker.io/rancher/klipper-helm|docker.io/rancher/klipper-helm>               v0.8.2-build20230815   5f89cb8137ccb       90.9MB
<http://docker.io/rancher/klipper-lb|docker.io/rancher/klipper-lb>                 v0.4.5                 17066c233afa3       7.82MB
<http://docker.io/rancher/local-path-provisioner|docker.io/rancher/local-path-provisioner>     v0.0.24                b29384aeb4b13       14.9MB
<http://docker.io/rancher/mirrored-coredns-coredns|docker.io/rancher/mirrored-coredns-coredns>   1.10.1                 ead0a4a53df89       16.2MB
<http://docker.io/rancher/mirrored-library-traefik|docker.io/rancher/mirrored-library-traefik>   2.10.5                 cc365cbb0397b       43.1MB
<http://docker.io/rancher/mirrored-metrics-server|docker.io/rancher/mirrored-metrics-server>    v0.6.3                 817bbe3f2e517       29.9MB
<http://docker.io/rancher/mirrored-pause|docker.io/rancher/mirrored-pause>             3.6                    6270bb605e12e       301kB
looks right to me
g
I have that as well. But when trying to start a pod with
kubectl run -it --rm --image=alpine alpine -- ash
, the image can't be pulled and the pod does not start
c
do you have the correct tag? Do you have the correct ImagePullPolicy?
You’re not specifying a tag, so the implicit tag is
latest
which also has an implicit ImagePullPolicy of Always
neither of which are probably what you want
Have you tried
--image=<http://docker.io/library/alpine:3.19|docker.io/library/alpine:3.19>
instead of just leaving so many things to the default?
alpine
is implicitly
<http://docker.io/library/alpine:latest|docker.io/library/alpine:latest>
I think. But you’re leaving a lot unspecified by just asking for
alpine
g
I have not. Regarding the pullPolicy, I was under the impression that the actual "pull" would be caught by the embedded registry. I do have the mirroring configuration set up per the docs as well as the default endpoint disabled per the docs as well.
I can try specifying a tag but I had loaded the alpine image with the "latest" tag to try that use case
c
avoid the
latest
tag when using mirrors. It has weird behavior since you don’t really know what it points at
g
Ok, thanks for the tip! I'll try with a specific tag.
c
if its still not working, check the containerd logs to see what specifically it is trying to pull and run. there’s a mismatch somewhere between what you’re importing and what you’re running.
g
Ok, I can confirm that with a specific tag, the Pod does start! (without changing anything else to the command)
I'll have to check if I can use the image with the "latest" tag by using an IfNotPresent policy
Some of the pullPolicies in our dev charts are still using the default 😕
Thanks for your help!