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.
dkp create cluster aws --cluster-name=$(whoami)-aws-cluster --ami ami-0123456789
Launch a DKP Cluster with Custom AMI Lookup
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. To create a cluster that will use the latest AMI, specify the --ami-format
, --ami-base-os
and --ami-owner
flags:
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.
You can view an example of that with the provided centos-79.yaml
snippet below:
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:
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:
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:
konvoy-image build aws path/to/ami/centos-79.yaml