You are viewing documentation for the Kairos release v3.2.4. For the latest release, click here.
How to Create an Airgap K3s Installation with Kairos
If you want to create an airgap K3s installation, Kairos provides a convenient way to do so using AuroraBoot. In this guide, we will go through the process of creating a custom ISO of Kairos that contains a configuration file and a bundle that executes preparatory steps after installation. The bundle will overlay new files in the system and prepare the node for having an airgapped K3s installation.
Note
If you already have a Kubernetes cluster, you can use the osbuilder controller to generate container images with your additional files already inside.Prerequisites
Docker running in the host
Creating the Bundle
First, we need to create a bundle that contains the K3s images used for the airgap installation. The bundle will place the images in the /var/lib/rancher/k3s/agent/images
directory. The /var/lib/rancher
is already configured as persistent by Kairos defaults and every change to that directory persist reboots. You can add additional persistent paths in the system with the cloud config
- Create a new directory named
images-bundle
, and create a new file inside it calledDockerfile
. - Paste the following code into the
Dockerfile
:
- Create a new file called
run.sh
inside theimages-bundle
directory, and paste the following code:
- Make the
run.sh
file executable by running the following command:
- Build the container image by running the following command inside the images-bundle directory. This will save the image as
data/bundle.tar
:
- Save the bundle:
$ ls
images-bundle
# create a directory
$ mkdir data
$ docker save images-bundle -o data/bundle.tar
Building the Offline ISO for Airgap
Now that we have created the bundle, we can use it to build an offline ISO for the airgap installation.
- Create a cloud config for the ISO and save it as config.yaml. The config.yaml file should contain your cloud configuration for Kairos and is used to set up the system when it is installed. An example can be:
- Build the ISO with AuroraBoot by running the following command:
The resulting ISO should be available at: build/iso/kairos.iso
This example is also available in the AuroraBoot repository in the examples/airgap
directory, where you can run build_docker.sh
to reproduce the example.