Jump to main content

Image Side-loading

Image side-loading allows administrators to easily import a number of Docker (OCI) images (bundled in one or more .tar archives) to all the nodes of a MicroK8s clusters using a single command.

This can be very useful in the following situations:

  • Environments with limited or constrained access to DockerHub and other image registries.
  • Environments with limited bandwidth and/or connection speeds.
  • Import private images that are not published in any public registry.
  • It is not possible and/or desired to configure and run a private image registry.

Import images

MicroK8s supports importing standard OCI images from .tar archives.

Cluster-wide

NOTE: Image side-loading using the microk8s images import command is available in MicroK8s version 1.25 or newer.

Assume a MicroK8s cluster with the following nodes (output from microk8s kubectl get node -o wide command):

NAME     STATUS   ROLES    AGE     VERSION                    INTERNAL-IP     EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
uk8s-3   Ready    <none>   15m     v1.24.2-2+91ff6ac97631b3   10.86.101.42    <none>        Ubuntu 18.04.6 LTS   5.15.0-35-generic   containerd://1.6.6
uk8s-2   Ready    <none>   4m44s   v1.24.2-2+91ff6ac97631b3   10.86.101.110   <none>        Ubuntu 18.04.6 LTS   5.15.0-35-generic   containerd://1.6.6
uk8s-1   Ready    <none>   18m     v1.24.2-2+91ff6ac97631b3   10.86.101.105   <none>        Ubuntu 18.04.6 LTS   5.15.0-35-generic   containerd://1.6.6

If we have an OCI image called nginx.tar, we can load this to all the cluster nodes by running the following command on any of them:

microk8s images import < nginx.tar

A successful output looks like this:

Pushing OCI images to 10.86.101.105:25000
Pushing OCI images to 10.86.101.42:25000
Pushing OCI images to 10.86.101.110:25000

For a list of all available command options, see microk8s images import --help.

Only on local node

NOTE: For clusters, the steps below need to be repeated on all nodes.

It is also possible to load the images directly into the local containerd daemon like so:

microk8s ctr image import - < nginx.tar

On success, the output will look like this:

unpacking docker.io/library/nginx:latest (sha256:9c58d14962869bf1167bdef6a6a3922f607aa823196c392a1785f45cdc8c3451)...done

Export images

NOTE: Image side-loading using the microk8s images import command is available in MicroK8s version 1.25 or newer.

MicroK8s offers a single command that can be used to export all images from the local container runtime into a single archive.

microk8s images export-local > images.tar

Last updated 2 years ago. Help improve this document in the forum.