Skip to content

Instantly share code, notes, and snippets.

@clemenko
Last active February 4, 2025 14:24
Show Gist options
  • Save clemenko/e3a823732c23813b43ac18fef0b24498 to your computer and use it in GitHub Desktop.
Save clemenko/e3a823732c23813b43ac18fef0b24498 to your computer and use it in GitHub Desktop.

k3s airgap

Docs

https://docs.k3s.io/installation/airgap#manually-deploy-images-method
https://github.com/k3s-io/k3s/

download

# download these
mkdir /opt/k3s && cd /opt/k3s
curl -#LO https://github.com/k3s-io/k3s/releases/download/v1.32.1%2Bk3s1/k3s
curl -#L  https://get.k3s.io -o install.sh
curl -#LO https://github.com/k3s-io/k3s/releases/download/v1.32.1%2Bk3s1/k3s-airgap-images-amd64.tar

#Note - not needed for Debain based systems.
curl -#LO https://github.com/k3s-io/k3s-selinux/releases/download/v1.6.stable.1/k3s-selinux-1.6-1.el9.noarch.rpm
chmod 755 k3s install.sh

tar and move

this step should be self explanatory.

# compress
cd /opt/k3s
tar -vzcf /opt/k3s_airgapped.tgz $(ls)
# decompress
mkdir /opt/k3s
tar -vzxf /opt/k3s_airgapped.tgz -C /opt/k3s

install

run as root

cd /opt/k3s
mkdir -p /var/lib/rancher/k3s/agent/images/ 
mv k3s /usr/local/bin/
mv k3s-airgap-images-amd64.tar /var/lib/rancher/k3s/agent/images/

#Note - not needed for Debain based systems.
yum install -y container-selinux k3s-selinux-1.4-1.el9.noarch.rpm

INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
@clemenko
Copy link
Author

Awesome.

@davehouser1
Copy link

One last note. If your trying to add a worker node (agent) to a master node at install. Use this command to install the agent + connect to the master node: (replace $MASTER_NODE_IP_OR_FQDN, and $TOKEN_TO_USE accordingly. You can gather the master node token from cat /var/lib/rancher/k3s/server/node-token)

INSTALL_K3S_SKIP_DOWNLOAD=true K3S_URL=https://$MASTER_NODE_IP_OR_FQDN:6443 K3S_TOKEN=$TOKEN_TO_USE ./install.sh

Credit to this post that helped figure this out

@clemenko
Copy link
Author

clemenko commented Feb 1, 2025

Good call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment