You must have at least one image before creating a new cluster. As long as you have an image, this step in your configuration is not required each time since that image can be used to spin up a new cluster. However, if you need different images for different environments or providers, you will need to create a new custom image.

The following section describes how to use Konvoy Image Builder (KIB) with Amazon Web Services (AWS). There are two options:

Konvoy Image Builder has a more detailed section in the documentation if you need to refer there for compatible versions with DKP and other specific information.

Learn how to build a custom AMI for use with DKP

This procedure describes how to use the Konvoy Image Builder (KIB) to create a Cluster API compliant Amazon Machine Image (AMI). KIB uses variable overrides to specify base image and container images to use in your new AMI.

The default AWS image is not recommended for use in production. We suggest using Konvoy Image Builder to create a custom AMI to take advantage of enhanced cluster operations. Explore the KIB with AWS topics for more options.

Prerequisites

Before you begin, you must:

Extract KIB Bundle

Extract the bundle and cd into the extracted konvoy-image-bundle-$VERSION folder. The bundled version of konvoy-image contains an embedded docker image that contains all the requirements for building.

The konvoy-image binary and all supporting folders are also extracted. When run, konvoy-image bind mounts the current working directory (${PWD}) into the container to be used.

  • Set environment variables for AWS access. The following variables must be set using your credentials including required IAM:

    export AWS_ACCESS_KEY_ID
    export AWS_SECRET_ACCESS_KEY
    export AWS_DEFAULT_REGION
    CODE
  • If you have an override file to configure specific attributes of your AMI file, add it.

1. Create a Custom 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.

Execute the following to begin image creation:

Run the konvoy-image command to build and validate the image.

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

By default it builds in the us-west-2 region. to specify another region set the --region flag:

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

Ensure you have named the correct YAML file for your OS in the konvoy-image build command.

Once KIB provisions the image successfully, the ami id is printed and written to the manifest.json file. This file has an artifact_id field whose value provides the name of the AMI ID as shown in the example below:

{
      "name": "rhel-7.9-fips",
      "builder_type": "amazon-ebs",
      "build_time": 1659486130,
      "files": null,
      "artifact_id": "us-west-2:ami-0f2ef742482e1b829",
      "packer_run_uuid": "0ca500d9-a5f0-815c-6f12-aceb4d46645b",
      "custom_data": {
        "containerd_version": "",
        "distribution": "RHEL",
        "distribution_version": "7.9",
        "kubernetes_cni_version": "",
        "kubernetes_version": "1.24.5+fips.0"
      }
    }
CODE

2. Air-gapped AMI

Create an Image using Konvoy Image Builder (KIB) for use in an air-gapped cluster

Prerequisites

The default AWS image is not recommended for use in production. We suggest using Konvoy Image Builder to create an AWS Air-gapped AMI to take advantage of enhanced cluster operations. Explore the KIB with AWS topics for more options.

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

  1. Assuming you have downloaded dkp-air-gapped-bundle_v2.5.0_linux_amd64.tar.gz , extract the tarball to a local directory:

    tar -xzvf dkp-air-gapped-bundle_v2.5.0_linux_amd64.tar.gz && cd dkp-v2.5.0/kib
    CODE
  2. 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.

Execute the following to begin image creation:

Run the konvoy-image command to build and validate the image.

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

By default it builds in the us-west-2 region. to specify another region set the --region flag:

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

When the command is complete the ami id is printed and written to ./manifest.json.

Next Step:

Minimal Permissions and Role to Create Clusters