Skip to main content
Skip table of contents

Use Custom AMI to Build Cluster

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. By default konvoy-image will name the AMI in such a way that dkp can discover the latest AMI for a base OS and Kubernetes version.

CODE
dkp create cluster aws --cluster-name=$(whoami)-aws-cluster --ami ami-0123456789

OR

To launch a DKP Cluster with Custom AMI Lookup that will use the latest AMI, specify the --ami-format, --ami-base-os and --ami-owner flags, use this command instead:

CODE
dkp create cluster aws --cluster-name=$(whoami)-aws-cluster --ami-format "konvoy-ami-{{.BaseOS}}-?{{.K8sVersion}}-*" --ami-base-os centos-7 --ami-owner 123456789012

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. At times, a particular upstream AMI may not be available in your region or something could be renamed so you create a custom source AMI.

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"
...

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.