Air-Gapped Installation
Install k3s on machines with no internet access using the binary and a bundled images archive.
Syntax
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.shAn air-gapped environment has no internet access. k3s supports this well because it ships its system images as a downloadable archive.
The pieces you need
- The
k3sbinary for your architecture. - The
k3s-airgap-images-<arch>.tararchive from the GitHub release. - The install script (run with
INSTALL_K3S_SKIP_DOWNLOAD=true).
Place the images archive in /var/lib/rancher/k3s/agent/images/ and k3s will import it on startup instead of pulling from the internet.
Example
# On the offline machine, after copying the files across
sudo mkdir -p /var/lib/rancher/k3s/agent/images/
sudo cp k3s-airgap-images-amd64.tar \
/var/lib/rancher/k3s/agent/images/
sudo cp k3s /usr/local/bin/k3s
sudo chmod +x /usr/local/bin/k3s
# Run the install script without downloading anything
sudo INSTALL_K3S_SKIP_DOWNLOAD=true ./install.shWhen to use it
- A government facility installs k3s on air-gapped servers by transferring the binary and images tarball via USB drive.
- A ship's onboard computer cluster receives a k3s offline bundle during port visits, then operates autonomously at sea.
- A manufacturing plant deploys k3s on machines isolated from the public internet using a pre-pulled images archive for compliance reasons.
More examples
Download artifacts on a connected host
Downloads the k3s binary and the bundled images archive on an internet-connected machine for transfer to the air-gapped host.
VERSION=v1.29.3+k3s1
wget https://github.com/k3s-io/k3s/releases/download/${VERSION}/k3s
wget https://github.com/k3s-io/k3s/releases/download/${VERSION}/k3s-airgap-images-amd64.tar.gzPrepare the offline images
Places the images tarball where k3s expects it and installs the binary so the air-gapped install can proceed.
mkdir -p /var/lib/rancher/k3s/agent/images/
cp k3s-airgap-images-amd64.tar.gz /var/lib/rancher/k3s/agent/images/
chmod +x k3s && mv k3s /usr/local/bin/Run air-gapped install script
Runs a local copy of the install script with SKIP_DOWNLOAD so it uses the pre-placed binary and images instead of fetching them.
INSTALL_K3S_SKIP_DOWNLOAD=true \
INSTALL_K3S_EXEC='--node-ip 192.168.10.5' \
./install.sh
kubectl get nodes
Discussion