A repository with connected/ (bundle build scripts and an image list derived from the chart), inside/ (verify, mirror and install scripts), cluster/ (k3s and registry configuration), RUNBOOK.md and a recorded session showing: no internet inside, checksum verification, install of v6.14.0, an unbundled image failing to pull, and an offline upgrade to v6.15.0 with Helm history.
- Docker (Docker Desktop or Docker Engine) with about 4 GB of free memory
- Helm installed on your connected machine
- The packaging and air-gapped lessons of this track
- k3s — a Kubernetes distribution with a documented air-gap install ↗
- Docker internal networks — a network with no route out, so the air gap is real ↗
- skopeo — copy images to and from OCI archives and registries without a Docker daemon ↗
- Helm — pull charts on the connected side and install them inside ↗
- podinfo — a small, realistic application published as an OCI chart and image ↗
airgap-lab/
├── connected/
│ ├── images.txt # derived from the rendered chart
│ └── build-bundle.sh
├── inside/
│ ├── verify-and-mirror.sh
│ └── install.sh
├── cluster/
│ ├── registries.yaml # k3s: public names -> internal registry
│ └── start-k3s.sh
├── k3s-images/ # k3s air-gap images archive (downloaded once)
├── bundle-6.14.0/ bundle-6.15.0/
└── RUNBOOK.mdTick each step as you finish it — your progress is saved in this browser only (back up or restore on the hub). Every code block has a copy button. If something goes wrong, the troubleshooting section at the end covers the usual suspects.
Build the isolated environment
A Docker network with no internet route, an internal registry inside it, and proof that the inside cannot reach out.
- Create the lab folder and an internal Docker network.
--internalnetworks have no gateway to the outside world.bashmkdir -p airgap-lab/{connected,inside,cluster,k3s-images} && cd airgap-lab docker network create --internal airgap-net - Pre-pull the images the inside will need while you still can: the registry, k3s, a Helm client and skopeo. In a real engagement these too arrive as part of an approved bundle.bash
docker pull registry:2 docker pull rancher/k3s:v1.37.1-k3s1 docker pull alpine/helm:3.19.0 docker pull quay.io/skopeo/stable:latest - Start the internal registry on the isolated network.bash
docker run -d --name registry --network airgap-net registry:2 - Prove the network is isolated by trying to reach the internet from a container on it.bash
docker run --rm --network airgap-net alpine sh -c \ 'wget -q -T 5 -O /dev/null https://ghcr.io && echo INTERNET || echo no-internet'Check: The output isno-internet.
Install k3s from its air-gap images
A Kubernetes cluster running inside the isolated network, installed with the official offline images and configured to pull only from the internal registry.
- On the connected side, download the k3s air-gap images archive for your CPU architecture (
uname -mprints arm64 or x86_64) and the matching release.bashARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/') curl -L -o "k3s-images/k3s-airgap-images-${ARCH}.tar.zst" \ "https://github.com/k3s-io/k3s/releases/download/v1.37.1%2Bk3s1/k3s-airgap-images-${ARCH}.tar.zst"k3s loads any image archive placed in /var/lib/rancher/k3s/agent/images/ at start, which is exactly the documented air-gap method. - Write the registry mirror configuration so that images referenced as ghcr.io or docker.io are served from the internal registry, with no manifest edits.yaml
# cluster/registries.yaml mirrors: ghcr.io: endpoint: - "http://registry:5000" docker.io: endpoint: - "http://registry:5000"A real internal registry uses TLS with the customer's CA; plain HTTP is acceptable only inside this lab. - Start k3s inside the isolated network. k3s requires a default route even when there is no internet; its air-gap docs recommend a black-hole route through a dummy interface, which the entry command creates.bash
docker run -d --name k3s --hostname k3s --network airgap-net --privileged \ -v "$PWD/k3s-images:/var/lib/rancher/k3s/agent/images" \ -v "$PWD/cluster/registries.yaml:/etc/rancher/k3s/registries.yaml:ro" \ --entrypoint /bin/sh rancher/k3s:v1.37.1-k3s1 -c \ 'ip link add dummy0 type dummy && ip link set dummy0 up && ip addr add 203.0.113.254/31 dev dummy0 && ip route add default via 203.0.113.255 dev dummy0 metric 1000 && exec /bin/k3s server --tls-san k3s --disable traefik --disable metrics-server'Without the dummy route k3s exits with 'no default routes found'; that error is common on real air-gapped hosts too. - Wait for the node to become Ready and confirm the cluster itself cannot reach the internet.bash
until docker exec k3s kubectl get nodes 2>/dev/null | grep -q ' Ready'; do sleep 5; done docker exec k3s kubectl get nodes docker exec k3s sh -c 'wget -q -T 5 -O /dev/null https://ghcr.io && echo INTERNET || echo no-internet'Check: The node is Ready and the cluster reportsno-internet. - Create a kubeconfig for the jump box: the cluster's admin config with the server address changed to the container hostname, which is in the certificate thanks to
--tls-san k3s.bashdocker exec k3s cat /etc/rancher/k3s/k3s.yaml | sed 's#https://127.0.0.1:6443#https://k3s:6443#' > kubeconfig chmod 600 kubeconfig
Build the offline bundle (connected side)
Two versioned bundles, each containing every image and chart for one release, with checksums.
- Pull the application chart for the version you will install first and derive the image list from the rendered manifests rather than writing it by hand.bash
mkdir -p bundle-6.14.0/images bundle-6.14.0/charts helm pull oci://ghcr.io/stefanprodan/charts/podinfo --version 6.14.0 -d bundle-6.14.0/charts helm template podinfo bundle-6.14.0/charts/podinfo-6.14.0.tgz | grep -E '^\s+image:' | awk '{print $2}' | tr -d '"' | sort -u > connected/images-6.14.0.txt cat connected/images-6.14.0.txtCheck: The list contains ghcr.io/stefanprodan/podinfo:6.14.0 and also the helper images the chart's test hooks use (curl, grpc_health_probe, tiny-tools): exactly the kind of image people forget when they write the list by hand. - Write the bundle script: copy the image list into the bundle, export every listed image into an OCI archive with skopeo, then write checksums for everything except the checksum file itself.bash
cat > connected/build-bundle.sh <<'SCRIPT' #!/usr/bin/env bash set -euo pipefail VER="$1" B="bundle-$VER" cp "connected/images-$VER.txt" "$B/images.txt" # the list travels with the bundle while read -r img; do name=$(echo "$img" | tr '/:@' '___') docker run --rm -v "$PWD/$B:/b" quay.io/skopeo/stable:latest copy --all \ "docker://$img" "oci-archive:/b/images/$name.tar:$img" done < "$B/images.txt" (cd "$B" && find . -type f ! -name SHA256SUMS -exec shasum -a 256 {} \; > SHA256SUMS) SCRIPT chmod +x connected/build-bundle.sh ./connected/build-bundle.sh 6.14.0find ... ! -name SHA256SUMSmatters: without it the checksum file lists itself and verification always fails, a mistake this lab caught while it was being written. - Repeat for the next release, 6.15.0, which you will deliver later as an upgrade.bash
mkdir -p bundle-6.15.0/images bundle-6.15.0/charts helm pull oci://ghcr.io/stefanprodan/charts/podinfo --version 6.15.0 -d bundle-6.15.0/charts helm template podinfo bundle-6.15.0/charts/podinfo-6.15.0.tgz | grep -E '^\s+image:' | awk '{print $2}' | tr -d '"' | sort -u > connected/images-6.15.0.txt ./connected/build-bundle.sh 6.15.0 - Record what each bundle contains (versions, image digests, checksum file) in a short release note, as you would hand to a customer's change board.
Verify, mirror and install (inside)
The first release installed in the isolated cluster from the internal registry only.
- Verify the bundle's checksums before anything is loaded.bash
(cd bundle-6.14.0 && shasum -a 256 -c SHA256SUMS)Check: Every line says OK. - Push every image archive into the internal registry, keeping the repository path so the mirror configuration resolves the original names. skopeo runs on the isolated network, as an operator's tool inside the gap would.bash
cat > inside/verify-and-mirror.sh <<'SCRIPT' #!/usr/bin/env bash set -euo pipefail B="bundle-$1" (cd "$B" && shasum -a 256 -c SHA256SUMS) while read -r img; do name=$(echo "$img" | tr '/:@' '___') first="${img%%/*}" if [[ "$img" == */* && ( "$first" == *.* || "$first" == *:* ) ]]; then path="${img#*/}" # drop the registry host else path="$img" # docker.io short name [[ "$path" == */* ]] || path="library/$path" fi [[ "${path##*/}" == *:* || "$path" == *@* ]] || path="$path:latest" docker run --rm --network airgap-net -v "$PWD/$B:/b" quay.io/skopeo/stable:latest \ copy --all --dest-tls-verify=false "oci-archive:/b/images/$name.tar" "docker://registry:5000/$path" done < "$B/images.txt" SCRIPT chmod +x inside/verify-and-mirror.sh ./inside/verify-and-mirror.sh 6.14.0The script reads the image list carried in the bundle and maps each reference to a path in the internal registry: it drops the registry host (ghcr.io, docker.io), adds library/ for official Docker Hub images and :latest when no tag is given. Rebuilding names from archive file names instead breaks on images with underscores in their names, which is exactly what happened while this lab was being tested. - List what the internal registry now holds, so you can compare it with the bundle's image list.bash
docker run --rm --network airgap-net alpine \ wget -qO- http://registry:5000/v2/_catalogCheck: The catalog includes stefanprodan/podinfo and the helper images. - Install the chart from the bundle using Helm in a jump-box container on the isolated network.bash
helm_in() { docker run --rm --network airgap-net -v "$PWD:/w" -e KUBECONFIG=/w/kubeconfig \ alpine/helm:3.19.0 "$@" } helm_in upgrade --install podinfo /w/bundle-6.14.0/charts/podinfo-6.14.0.tgz \ -n demo --create-namespace --atomic --timeout 3mCheck: Helm reports STATUS: deployed. - Confirm the pod is running and that its image, still referenced by its public name, was pulled through the internal mirror.bash
docker exec k3s kubectl -n demo get pods docker exec k3s kubectl -n demo get events --field-selector reason=Pulled \ -o custom-columns=MSG:.message --no-headersCheck: The event says Successfully pulled image "ghcr.io/stefanprodan/podinfo:6.14.0", even though the cluster has no internet. - Run the chart's own tests inside the gap. They use the helper images you bundled, which is why those had to be in the image list.bash
docker exec k3s kubectl -n demo rollout status deploy/podinfo --timeout=120s helm_in test podinfo -n demo --timeout 3mCheck: The grpc, jwt and service tests all report Phase: Succeeded. - Prove the gap works: try to run an image that was never bundled and watch it fail.bash
docker exec k3s kubectl -n demo run probe --image=nginx:1.27 --restart=Never sleep 20 docker exec k3s kubectl -n demo get pod probe docker exec k3s kubectl -n demo delete pod probe --nowCheck: The probe pod shows ErrImagePull or ImagePullBackOff.
Deliver an upgrade offline
The next release applied through the same verified path, with rollback available.
- Verify and mirror the 6.15.0 bundle exactly as before.bash
./inside/verify-and-mirror.sh 6.15.0 - Upgrade atomically and check history.bash
helm_in upgrade podinfo /w/bundle-6.15.0/charts/podinfo-6.15.0.tgz -n demo --atomic --timeout 3m docker exec k3s kubectl -n demo get deploy podinfo \ -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}' helm_in history podinfo -n demoCheck: The image is now 6.15.0 and history shows revision 1 superseded, revision 2 deployed. - Practise the rollback an operator would use if the new version misbehaved.bash
helm_in rollback podinfo 1 -n demo docker exec k3s kubectl -n demo get deploy podinfo \ -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'Check: The image is back to 6.14.0, still with no internet access.
Runbook, record and tear down
Operator documentation for offline delivery and a clean environment afterwards.
- Write RUNBOOK.md: prerequisites, how to verify a bundle, how to mirror, how to install and upgrade, how to roll back, and failure entries for checksum mismatch, ImagePullBackOff (image missing from bundle or mirror), and k3s failing to start with 'no default routes found'.
- Record a terminal session demonstrating the whole flow and commit scripts, configuration and the runbook (not the large image archives).bash
printf 'bundle-*/images/\nk3s-images/\nkubeconfig\n' > .gitignore git init && git add -A && git commit -m "Air-gapped delivery lab: k3s + internal registry + verified bundles" - Tear everything down.bash
docker rm -f k3s registry docker network rm airgap-netCheck:docker ps -ashows neither container and the network is gone.
Troubleshooting
- k3s exits immediately with 'no default routes found'
- Air-gapped hosts need a default route; add the dummy-interface black-hole route as in the start command (this is the method k3s's air-gap docs describe).
- Pods stay in ImagePullBackOff for an image you bundled
- Check the image was pushed under the same repository path (
stefanprodan/podinfo:6.14.0) and that registries.yaml mirrors the image's registry host. List the registry withdocker run --rm --network airgap-net alpine wget -qO- http://registry:5000/v2/_catalog. - shasum -c reports SHA256SUMS: FAILED
- The checksum file was included in itself; regenerate with
find . -type f ! -name SHA256SUMS .... - Helm cannot connect to the cluster
- Make sure the kubeconfig server is https://k3s:6443, the Helm container runs on airgap-net, and k3s was started with --tls-san k3s.
- The cluster pulled an image you did not bundle
- Your network is not isolated. Confirm the network was created with --internal and that k3s is attached only to it (
docker inspect k3s).
Where to go from here
- Replace the HTTP registry with TLS using your own CA and configure k3s to trust it in registries.yaml.
- Add a self-hosted model to the bundle (an inference engine image plus weights) and serve it offline with HF_HUB_OFFLINE=1.
- Repeat the delivery with Zarf (zarf package create, zarf init, zarf package deploy) and compare effort and robustness.
- Sign images on the connected side with cosign and verify signatures inside before mirroring.
- Add your own chart from the packaging lesson and bundle its dependencies (for example a database) too.
Did a step fail or feel unclear? Tell me which one →