Skip to main content
Skip table of contents

Custom AMI in Cluster Creation

Launch a DKP Cluster with a Custom AMI

To use the built ami with DKP, specify it with the --ami flag when calling cluster create.

CODE
dkp create cluster aws \
--cluster-name=${CLUSTER_NAME} \
--additional-tags=owner=$(whoami) \
--with-aws-bootstrap-credentials=true \
--ami AMI_ID

Launch a DKP Cluster with Custom AMI Lookup

By default, the konvoy-image command in KIB will name the AMI in such a way that dkp can discover the latest AMI for a base OS and Kubernetes version. To create a cluster that will use the latest AMI, specify the --ami-format, --ami-base-os and --ami-owner flags:

CODE
dkp create cluster aws \
--cluster-name=${CLUSTER_NAME} \
--additional-tags=owner=$(whoami) \
--with-aws-bootstrap-credentials=true \
--ami-owner AWS_ACCOUNT_ID \
--ami-base-os ubuntu-20.04 \
--ami-format 'konvoy-ami-{{.BaseOS}}-?{{.K8sVersion}}-*'

Using Custom Source AMIs

When using KIB for building machine images to Amazon, the default source AMIs that we provide are modeled by looking up an AMI based on the owner. Then we apply a filter for that operating system and version.

You can view an example of that with the provided centos-79.yaml snippet below:

CODE
download_images: true

packer:
  ami_filter_name: "CentOS Linux 7"  
  ami_filter_owners: "125523088429"  
  distribution: "CentOS"  
  distribution_version: "7.9"  
  source_ami: ""  
  ssh_username: "centos"  
  root_device_name: "/dev/sda1"
...

At times, a particular upstream AMI may not be available in your region or something could be renamed. Other times you want to provide a custom AMI. If this is the case, you will want to edit or create your own YAML file that looks up based on the source_ami field. For example, you can select images that are otherwise deprecated.

Once you select the source AMI that you want, you can declare that when running your build command:

CODE
konvoy-image build aws path/to/ami/centos-79.yaml --source-ami ami-0123456789

Alternatively, if you want to add it to your YAML file, or make your own file, you can do that as well. You add that AMI ID into the source_ami in the YAML file:

CODE
download_images: true

packer:
  ami_filter_name: ""
  ami_filter_owners: ""
  distribution: "CentOS"
  distribution_version: "7.9"
  source_ami: "ami-123456789"
  ssh_username: "centos"
  root_device_name: "/dev/sda1"
...

When you're done selecting your source_ami, you can build your KIB image as you would normally:

CODE
konvoy-image build aws path/to/ami/centos-79.yaml
JavaScript errors detected

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

If this problem persists, please contact our support.