---
title: "Air-Gapped Kubernetes Installations for Edge Sites"
date: "2026-11-15T07:18:00+07:00"
description: "A repeatable offline install pattern for K3s at the edge: artifact sets, registries.yaml mirroring, preloaded image tarballs, offline bootstrap, and GitOps-by-bundle update cadence."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/air-gapped-kubernetes-edge-sites.jpg"
alt: "Technician carrying a sealed transfer drive to an industrial edge cabinet with a small server and no network uplink"
tags: ['kubernetes', 'k3s', 'air-gap', 'edge-operations', 'gitops']
---

The hardest Kubernetes installs are the ones with no internet. Substation cabinets, factory floors, ships, and classified networks all share the same constraint: the cluster must come up, run, and be patched for years without a single outbound connection. K3s is the distribution most often chosen for this — its docs list "air-gapped environments" as a first-class use case, and its design (one binary, batteries included, bundled containerd) collapses the usual offline dependency graph. But air-gapped is not a flag you flip at install time; it is an artifact pipeline, a registry topology, a bootstrap procedure, and an update cadence that you design before the first node boots. This post walks through that full pattern.

## The offline artifact set

Everything the installer would normally `curl` must exist as a file you can move by hand. For a given K3s version (say `v1.33.3+k3s1`), that set is:

- **The K3s binary** for each architecture in the fleet (`amd64`, `arm64`, `arm`), placed at `/usr/local/bin/k3s` and made executable.
- **The install script** (`get.k3s.io` saved as `install.sh`), run with `INSTALL_K3S_SKIP_DOWNLOAD=true` so it never phones home.
- **The air-gap images archive** per architecture: `k3s-airgap-images-amd64.tar.zst` (`.tar.gz` and plain `.tar` also exist; zst is the recommended distribution format). These archives carry everything the bundled components need — klipper-helm, klipper-lb, local-path-provisioner, mirrored CoreDNS, Traefik, metrics-server, pause — plus your workloads' images if you choose to bundle them.
- **The SELinux policy RPM** (`k3s-selinux`) if nodes run SELinux in enforcing mode — it cannot be pulled from a repo that doesn't exist offline.
- **Helm chart bundles and manifest files** for everything you deploy (more on this below).

Version discipline is the whole game here: the binary, the images archive, and the manifests must be the *same* release. Air-gap failures are almost always a version skew between two artifacts that were fetched on different days.

## Three ways to load images

The K3s air-gap docs offer three loading strategies, and the right choice depends on fleet size.

**1. Private registry (best for a site with many nodes).** On an internet-connected machine, load the images archive into Docker, retag, and push to an OCI registry inside the air gap:

```bash
docker load < k3s-airgap-images-amd64.tar.zst
docker tag <image> registry.edge.local/library/<image>:<tag>
docker push registry.edge.local/library/<image>:<tag>
```

Then point every node at it via `/etc/rancher/k3s/registries.yaml`:

```yaml
mirrors:
  docker.io:
    endpoint:
      - "https://registry.edge.local"
  registry.k8s.io:
    endpoint:
      - "https://registry.edge.local"
configs:
  "registry.edge.local":
    tls:
      ca_file: /etc/rancher/k3s/ca-registry.crt
    auth:
      username: k3s
      password: <from-a-secret-management-flow>
```

For strict environments, add `--disable-default-registry-endpoint` so containerd never attempts the default Docker Hub endpoint as a fallback — a real air gap means failed lookups are errors you want to see, not silent multi-minute timeouts.

**2. Manual tarball drop (best for small or scattered sites).** No registry at all: copy the archive into `/var/lib/rancher/k3s/agent/images/` on each node. K3s scans that directory on every start, decompresses `.tar`/`.tar.gz`/`.tar.zst`, and imports the layers into containerd before the kubelet starts. This is the right pattern when running a registry at a one- or two-node site is more operational burden than it is worth.

Because re-importing large archives on every restart delays kubelet startup, create an empty `.cache.json` in that directory to enable conditional imports — archives are then only reprocessed when size or mtime changes. The documented trade-off: if an image is pruned from the store while the cache says it's current, you must intervene manually (`ctr image import`, touch the archive, or clear the cache).

**3. Embedded distributed registry mirror (best for image sharing across nodes).** K3s bundles Spegel, an embedded OCI mirror: images present in any node's containerd store can be pulled by other cluster members with no external registry at all. This complements the tarball method — you preload each node once, and the cluster then distributes images peer-to-peer, which is exactly what you want when nodes join incrementally over months.

One more thing worth stating explicitly: **signature verification moves upstream.** There is no Notary/Content Trust handshake available mid-air-gap, so the honest place to verify signatures (e.g. with `cosign verify`) is the promotion step where artifacts enter the transfer chain, not at pull time on the node. The air gap itself then acts as a coarse trust boundary — which is why the physical media chain matters.

## Bootstrap without the internet

The install itself is straightforward once artifacts are local:

```bash
# server node
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh

# agent nodes
INSTALL_K3S_SKIP_DOWNLOAD=true \
  K3S_URL=https://<SERVER_IP>:6443 \
  K3S_TOKEN=<token> ./install.sh
```

The offline-specific pitfalls are small but sharp:

- **No default route.** K3s needs a default route to auto-detect the node's primary IP, and kube-proxy's ClusterIP routing depends on it. Nodes on isolated VLANs often lack one — a black-hole route via a dummy interface satisfies it:

```bash
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
```

- **Certificates and tokens are generated offline and must be transported deliberately.** K3s writes the kubeconfig to `/etc/rancher/k3s/k3s.yaml` and the join token to `/var/lib/rancher/k3s/server/node-token`. Moving these onto the site is a security event, not a file copy: treat the token like a root credential, rotate it after bootstrap (`--token` re-run or rotating via the docs' procedure), and never carry them on the same medium as the update bundle.
- **HA offline clusters use the same pattern** with either an external datastore (Postgres/etcd outside the site, which defeats the purpose) or K3s' embedded etcd across three servers — the embedded option is the air-gap-friendly one because the datastore lives inside the artifact set you already control.

## Applying workloads: manifests beat the internet

The default K3s HelmChart controller will happily try to fetch charts from a URL — which times out forever in an air gap. Two workable patterns:

1. **Ship chart archives as artifacts.** Drop `.tgz` chart tarballs and image tarballs into a bundle; reference them with `url: file:///opt/bundles/charts/redis-19.6.4.tgz` in the HelmChart resource.
2. **Render to plain manifests.** Run `helm template` or `kustomize build` on the internet-connected side and commit the rendered YAML as your deployment artifact. For small sites this is the more honest option — what ships is exactly what applies, with no controller-side resolution to fail.

For images referenced by workloads, prefill containerd from a manifest list: a plain text file in `/var/lib/rancher/k3s/agent/images/` with one image per line is pulled at K3s startup through the CRI API using your `registries.yaml` mirrors.

## Updates by physical media, and the patching cadence

Offline does not mean unpatched — it means the update channel is a file transfer, and you should design it like one:

- **Build a versioned update bundle** per release: binary, per-arch images archive, rendered manifests, chart tarballs, checksums (`sha256sum`), and a signed manifest describing the intended state. Sign the bundle index; verify checksums on arrival.
- **Sync by the least-rotten channel available**: sneakernet SD cards, an approved file-transfer system, or one-way data diode where policy requires it. GitOps engines (Flux or Argo CD) still work — they just need a Git remote reachable from the site. A common pattern is a read-only mirror of the repo updated from the bundle, so the cluster's desired state converges from local Git rather than a cloud control plane.
- **Decide your drift story explicitly.** In an air gap, drift accumulates between visits: someone kubectl-edits a deployment during an outage window, an image gets pruned, a cert expires on a schedule nobody is watching. Run `kubectl diff`/`kubectl diff -f` as a scheduled job inside the site (or collect `kubectl get -o yaml` snapshots into the outbound telemetry bundle if even that is restricted) and reconcile at the *next* visit — but alert locally on cert expiry (`k3s certificate check-expiration`) because expired serving certs are the classic air-gap outage.
- **Set a cadence, not "as needed."** A defensible default for critical sites: security patches every month if the transfer channel allows it, full version upgrades every quarter or per upstream support window, and a documented maximum age after which the site is flagged non-compliant even though nothing is visibly broken.

The design goal is boring: a new node can be racked with only the bundle, brought up to a known state, and a yearly patch is a file copy plus a systemd restart — no DNS for `registry.k8s.io` required at any point in the lifecycle.

## References

- K3s Air-Gap Installation: https://docs.k3s.io/installation/airgap
- K3s — Import Images (preload and tarball mechanisms): https://docs.k3s.io/add-ons/import-images
- K3s — Private Registry configuration (`registries.yaml`): https://docs.k3s.io/installation/private-registry
- K3s documentation (introduction and add-ons): https://docs.k3s.io/
- K3s blog — K3s strategies for image consumption: https://docs.k3s.io/blog/2025/11/11/strategies-for-large-images
