FatmanUK / k3s_playground

0 stars 0 forks source link

"meta_images_fetch : Copy image into cluster" takes a really long time #281

Open FatmanUK opened 5 months ago

FatmanUK commented 5 months ago

Can I shorten it by collecting all the images into one big tar? Or would that make it worse?

FatmanUK commented 5 months ago

How about doing a docker pull directly from build host docker to cluster?

FatmanUK commented 5 months ago

Possibly upload docker-registry by slow method, enable, then push all apps to it?

athajaerel commented 5 months ago

Q: How to copy many Docker images into a VM?

A: Stand up a Docker registry (not just podman) on the vm-host.

@vm $ sudo xbps-install -Ay podman

Get the registry image into the vm-host.

@build $ podman image exists docker.io/registry:2.8.1
@build $ [ $? -eq 1 ] && podman image pull docker.io/registry:2.8.1
@build $ podman save docker.io/registry:2.8.1 --format oci-archive -o /dev/shm/registry.tar
@build $ tar cpzf - /dev/shm/registry.tar | ssh vm tar xvpzf - -C /

Run the registry on the VM host.

@vm $ </dev/shm/registry.tar podman load
@vm $ podman run --rm -d -p 5000:5000 --name registry docker.io/registry:2.8.1

For images...

IMG_ID=d6e34de69afe
ORIG_TAG=ghcr.io/dreamtrack-net/kerberos
@build $ podman tag ${IMG_ID} vm:5000/${ORIG_TAG}
@build $ podman push vm:5000/${ORIG_TAG} --tls-verify=false

@vm $ podman pull localhost:5000/${ORIG_TAG} --tls-verify=false
@vm $ podman untag localhost:5000/${ORIG_TAG}
@vm $ podman tag ${IMG_ID} ${ORIG_TAG}
@vm $ podman save ${ORIG_TAG} --format oci-archive -o ~/kerb.tar
FatmanUK commented 5 months ago

No good: tagging and pushing has to happen serially, which makes it takes three times as long. :/

athajaerel commented 5 months ago

Tagging not needed after all; push with:

podman push {{ image or id }} docker://{{ registry_ip }}:5000/{{ image }} --tls-verify=false

Possibly need --remove-signatures in there too. If I care about signatures at some point, I can add a check on the build host.

athajaerel commented 5 months ago

podman save is nightmarishly slow. I've seen it take 12s to save a single image. Perhaps it would be better to leave the images in podman and push them into crictl later on?

athajaerel commented 5 months ago

Note to self, look at WiFi 7 routers. Time to replace that crappy TPLINK.