Skip to content

Instantly share code, notes, and snippets.

Last active October 4, 2023 19:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lalyos/02fd3b75fc0152a334a5298286164741 to your computer and use it in GitHub Desktop.
k3s with airgap image prewarmed
mkdir -p /var/lib/rancher/k3s/agent/images/
VERSION_K3S=$(curl -w '%{url_effective}' -L -s -S -o /dev/null | sed -e 's|.*/||')
curl -sL -o /var/lib/rancher/k3s/agent/images/airgap-images.tar${VERSION_K3S}/k3s-airgap-images-amd64.tar

Install k3s

Usually k3s is installed with a shell script:

curl -sL | sh

This will download the k3s binary create a systemd service and start it. Start time includes the download of system images:


Spedup startup by pre-downloading images

To speed-up startup time, you can pre download images (make part of your vm/docker image) with the 3 lines above: []

Additional images

Lets say you want to add nginx golang and alpine to the prewarmed images, you can use crane to download images:

# install crane
curl -sL | tar -xz -C /usr/local/bin/ crane

download images
for img in alpine nginx:alpine golang:alpine; do 
  crane pull ${img} /var/lib/rancher/k3s/agent/images/${img}.tar



to figure put the system image names you can start up k3s and after 1 minute or so:

kubectl  get no -o jsonpath='{range .items[0].status.images[*].names[0]}{$}{"\n"}{end}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment