Base image override files

Base image override files

When using Konvoy Image Builder (KIB) to create a base OS image, compliant with DKP, the instructions on how to build and configure the image are included in the file located in images/<builder-type>/<os>-<version>.yaml:

./konvoy-image build images/<builder-type>/{os}-{version}.yaml

NOTE: In previous versions of the konvoy-image, only azure and aws providers were available, therefore specifying a vsphere was not necessary.

Although there are several parameters specified by default in the packer templates for each provider, it is possible to override the default values. One option is to execute KIB with specific flags to override the values of the source AMI (--source-ami), AMI region (--ami-regions), AWS EC2 instance type (--aws-instance-type), and so on. For a comprehensive list of these flags, please run:

./konvoy-image build --help

Another option is by creating a file with the parameters to be overriden and specify the --overrides flag as shown below:

NOTE: While CLI flags can be used in combination with override files, CLI flags take priority over any override files.

./konvoy-image build images/<builder-type>/<os>-<version>.yaml --overrides overrides.yaml

Example 1:

For example, when using the AWS Packer builder to override the above base image with another base image, create an override file and set the source_ami under the packer key. This overrides the image search and forces the use of the specified source_ami.

---
packer:
  source_ami: "ami-0123456789"   

After creating the override file for our source_ami, we can pass our override file by using the --overrides flag when building our image:

./konvoy-image build images/ami/centos-7.yaml --overrides override-source-ami.yaml

Example 2:

To abide to security practices, a user could set their own username and password while creating the base OS image and override the default credentials in KIB by creating a file with the following content:

---
packer:
  ssh_username: "<USERNAME>"
  ssh_password: "<PASSWORD>"  

For a complete list of the variables that can be modified for each packer builder, users can refer to:

AWS packer template

Azure packer template

GCP packer template

vSphere packer template