Skip to main content
Skip table of contents

Custom AMI in Air-gapped Cluster Creation

Air-gapped AMI

To create an Image using Konvoy Image Builder (KIB) for use in an air-gapped cluster, follow these instructions. AMI images contain configuration information and software to create a specific, pre-configured, operating environment. For example, you can create an AMI image of your current computer system settings and software. The AMI image can then be replicated and distributed, creating your computer system for other users. You can use overrides files to customize some of the components installed on your machine image. For example, you could tell KIB to install the FIPS versions of the Kubernetes components.

Prerequisites

In previous DKP releases, AMI images provided by the upstream CAPA project would be used if you did not specify an AMI. However, the upstream images are not recommended for production and may not always be available.  Therefore, DKP now requires you to specify an AMI when creating a cluster. To create an AMI, use Konvoy Image Builder.

Explore the Customize your Image topic for more options.

Using KIB, you can build an AMI without requiring access to the internet by providing an additional --override flag.

In previous DKP releases, the distro package bundles were included in the downloaded air-gapped bundle. Currently, that air-gapped bundle contains the following artifacts with the exception of the distro packages:

  • DKP Kubernetes packages

  • Python packages (provided by upstream)

  • Containerd tarball

  1. Download dkp-air-gapped-bundle_v2.8.1_linux_amd64.tar.gz , and extract the tarball to a local directory:

    CODE
    tar -xzvf dkp-air-gapped-bundle_v2.8.1_linux_amd64.tar.gz && cd dkp-v2.8.1/kib
  2. You will need to fetch the distro packages as well as other artifacts. By fetching the distro packages from distro repositories, you get the latest security fixes available at machine image build time.

  3. In your download location, In your download location with internet access, you need to create an OS package bundle for the Target OS you use for the nodes in your DKP cluster. To create it, run the new DKP command create-package-bundle. This builds an OS bundle using the Kubernetes version defined in ansible/group_vars/all/defaults.yaml. Example command:

    CODE
    ./konvoy-image create-package-bundle --os redhat-8.4 --output-directory=artifacts

    Other supported air-gapped Operating Systems (OSs) can be specified in place of --os redhat-8.4 using the flag and corresponding OS name:

    • centos-7.9

    • redhat-7.9

    • redhat-8.6

    • redhat-8.8

    • rocky-9.1

    • ubuntu-20.04

    NOTE: For FIPS, pass the flag: --fips
    NOTE: For RHEL OS, pass your RedHat subscription/licensing manager credentials: Example command:

    CODE
    export RHSM_ACTIVATION_KEY="-ci"
    export RHSM_ORG_ID="1232131"

    OR

    CODE
    export RHSM_USER=""
    export RHSM_PASS=""
  4. Follow the instructions below to build an AMI.

Depending on which version of DKP you are running, steps and flags will be different. To deploy in a region where CAPI images are not provided, you need to use KIB to create your own image for the region. For a list of supported AWS regions, refer to the Published AMI information from AWS.

Run the following to begin image creation:
  1. Run the konvoy-image command to build and validate the image. Ensure you have named the correct AMI image YAML file for your OS in the konvoy-image build command.

    CODE
    ./konvoy-image build aws images/ami/centos-79.yaml --overrides overrides/offline.yaml

By default, it builds in the us-west-2 region. To specify another region set the --region flag as shown in the example command below:

CODE
./konvoy-image build aws --region us-east-1 images/ami/centos-79.yaml --overrides overrides/offline.yaml

Instructions for customizing an override file are found on this page: Image Overrides

After KIB provisions the image successfully, the ami id is printed and written to the packer.pkr.hcl (Packer config) file. This file has an amazon-ebs.kib_image field whose value provides the name of the AMI ID as shown in the example below. That is the ami you use in the dkp create cluster command:

CODE
...
    amazon-ebs.kib_image: Adding tag: "distribution_version": "8.6"
    amazon-ebs.kib_image: Adding tag: "gpu_nvidia_version": ""
    amazon-ebs.kib_image: Adding tag: "kubernetes_cni_version": ""
    amazon-ebs.kib_image: Adding tag: "build_timestamp": "20231023182049"
    amazon-ebs.kib_image: Adding tag: "gpu_types": ""
    amazon-ebs.kib_image: Adding tag: "kubernetes_version": "1.28.7"
==> amazon-ebs.kib_image: Creating snapshot tags
    amazon-ebs.kib_image: Adding tag: "ami_name": "konvoy-ami-rhel-8.6-1.26.6-20231023182049"
==> amazon-ebs.kib_image: Terminating the source AWS instance...
==> amazon-ebs.kib_image: Cleaning up any extra volumes...
==> amazon-ebs.kib_image: No volumes to clean up, skipping
==> amazon-ebs.kib_image: Deleting temporary security group...
==> amazon-ebs.kib_image: Deleting temporary keypair...
==> amazon-ebs.kib_image: Running post-processor:  (type manifest)
Build 'amazon-ebs.kib_image' finished after 26 minutes 52 seconds.

==> Wait completed after 26 minutes 52 seconds

==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs.kib_image: AMIs were created:
us-west-2: ami-04b8dfef8bd33a016

--> amazon-ebs.kib_image: AMIs were created:
us-west-2: ami-04b8dfef8bd33a016

Use the Custom AMI in Cluster Creation

To use a custom AMI when creating your cluster, you must create that AMI using KIB first. Then perform the export and name the custom AMI for use in the command dkp create cluster:

The export command is similar to this:

CODE
export AWS_AMI_ID=ami-ami-04b8dfef8bd33a016

The create cluster command would then be:

CODE
dkp create cluster aws --ami=${AWS_AMI_ID}

Inside the section for Air-gapped cluster creation, you will find the instructions for how to apply custom images.

More information about using the custom AMI in cluster creation can be found here: Use Custom AMI to Build Cluster.

Next Step

AWS Air-gapped Loading the Registry

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.