Skip to content
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

Create archive for the minikube images #7767

Closed
afbjorklund opened this issue Apr 18, 2020 · 5 comments
Closed

Create archive for the minikube images #7767

afbjorklund opened this issue Apr 18, 2020 · 5 comments
Labels
co/runtime/containerd co/runtime/crio CRIO related issues kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@afbjorklund
Copy link
Collaborator

afbjorklund commented Apr 18, 2020

(breakout from issue #7737, as a released file)

As an alternative to the current preload tarball, where it cannot be used (for various reasons).
It would contain the same essentials and auxiliary images, but in a more portable format

Additionally it would work in all container runtimes, the preload requires one tarball for each.
As well as allow loading with all storage drivers, those also require different tarball variants.

Current:
preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4

preloaded-images-k8s-v2-v1.18.0-containerd-overlay2-amd64.tar.lz4
preloaded-images-k8s-v2-v1.18.0-crio-overlay-amd64.tar.lz4

Side note: the overlayfs storage format is just called "overlay" in github.com/containers/storage
(probably because there was no need for a "overlay2" to replace a previous "overlay" attempt*)

* see https://docs.docker.com/storage/storagedriver/overlayfs-driver/

Example:
images-k8s-v1.18.0-amd64.tgz

One could additionally use different format (oci-archive instead of docker-archive) as well as
different compression (xz instead of gz), but then it will not work with all container runtimes.

docker save $images | gzip -9 > images.tgz

podman save --format oci-archive $images > images.tar && xz < images.tar > images.txz

The preload tarball also contains the kubernetes programs, but those would be excluded here.
(e.g.kubeadm kubelet kubectl, as they are not container images but regular executables)

Related issues:

For Docker, the current preload is still the fastest option (prepared format, faster compression)

So this is a portable alternative, with a more compatible format and more compatible compression:

  • from ./lib/docker/overlay2/ (and friends) to manifest.json (and friends)

  • from lz4 to gzip

@afbjorklund afbjorklund added co/docker-driver Issues related to kubernetes in container co/podman-driver podman driver issues co/runtime/docker Issues specific to a docker runtime kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. co/runtime/containerd co/runtime/crio CRIO related issues and removed co/runtime/docker Issues specific to a docker runtime priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. co/docker-driver Issues related to kubernetes in container co/podman-driver podman driver issues labels Apr 18, 2020
@afbjorklund
Copy link
Collaborator Author

One small problem with this is that the feature is currently broken in podman:

$ docker images k8s.gcr.io/pause
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
k8s.gcr.io/pause    3.2                 80d28bedfe5d        2 months ago        683kB
k8s.gcr.io/pause    3.1                 da86e6ba6ca1        2 years ago         742kB
$ docker save k8s.gcr.io/pause:3.1 k8s.gcr.io/pause:3.2 > images.tar
$ docker load -i images.tar 
Loaded image: k8s.gcr.io/pause:3.1
Loaded image: k8s.gcr.io/pause:3.2
$ podman load -i images.tar
  Unexpected tar manifest.json: expected 1 item, got 2
  open images.tar/manifest.json: not a directory
Error: error pulling "": unable to pull dir:images.tar: unable to pull image: Error determining manifest MIME type for dir:images.tar: open images.tar/manifest.json: not a directory

That is, load currently only supports one image per archive. And save is broken:

$ podman images k8s.gcr.io/pause
REPOSITORY         TAG   IMAGE ID       CREATED        SIZE
k8s.gcr.io/pause   3.2   80d28bedfe5d   2 months ago   688 kB
k8s.gcr.io/pause   3.1   da86e6ba6ca1   2 years ago    749 kB
$ podman save k8s.gcr.io/pause:3.1 k8s.gcr.io/pause:3.2 > images.tar
$ docker load -i images.tar
e17133b79956: Loading layer [==================================================>]  744.4kB/744.4kB
Loaded image: k8s.gcr.io/pause:3.1
Loaded image: k8s.gcr.io/pause:3.2
$ docker images k8s.gcr.io/pause
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
k8s.gcr.io/pause    3.1                 da86e6ba6ca1        2 years ago         742kB
k8s.gcr.io/pause    3.2                 da86e6ba6ca1        2 years ago         742kB

So this feature is mostly for containerd and other storage drivers, until podman is fixed...
Actually the real issue is in the underlying github.com/containers/image library, but anyway.

@afbjorklund
Copy link
Collaborator Author

The workaround for cri-o (and others, as well) is just to use the current minikube cache...

Since it creates one cache file per container image, the problems above are not exposed.

The OCI format is not widely used at the moment, so might as well stay with the Docker format.

And since by default the layers are stored as .tar.gz, compressing them again don't yield much.

@afbjorklund afbjorklund added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. labels Apr 19, 2020
@afbjorklund
Copy link
Collaborator Author

With the amount of problems this still has, and the lack of benefit vs. the preload - lowered priority.
The current cache mechanism should be "good enough", and the preload is a bigger improvement.

@afbjorklund
Copy link
Collaborator Author

afbjorklund commented Apr 21, 2020

One simple option, if wanting a one-file download also for the others is to tar up the cache folder...
That is: to create an archive of archives, where the top archive contains one file for each image

gcr.io/
gcr.io/k8s-minikube/
gcr.io/k8s-minikube/storage-provisioner_v1.8.1
k8s.gcr.io/
k8s.gcr.io/pause_3.2
k8s.gcr.io/kube-apiserver_v1.18.0
k8s.gcr.io/kube-controller-manager_v1.18.0
k8s.gcr.io/kube-scheduler_v1.18.0
k8s.gcr.io/etcd_3.4.3-0
k8s.gcr.io/kube-proxy_v1.18.0
k8s.gcr.io/coredns_1.6.7
kubernetesui/
kubernetesui/metrics-scraper_v1.0.2
kubernetesui/dashboard_v2.0.0-rc6

386M images.tar
383M images.tgz

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/runtime/containerd co/runtime/crio CRIO related issues kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

3 participants