Image Overrides
When using KIB to create an OS image that is compliant with DKP, the parameters for building and configuring the image are included in the file located in images/<builder-type>/<os-version.yaml
where <builder-type> is infrastructure provider specific such as ami
or ova
.
Run the command for those files:
./konvoy-image build images/<builder-type>/{os}-{version}.yaml
The YAML for each provider and OS is also located in GitHub.
Although there are several parameters specified by default in the Packer templates for each provider, it is possible to override the default values with flags and override files.
Using Flags
To execute KIB with specific flags to override the following values:
the source AMI (
--source-ami
)AMI region (
--ami-regions
)AWS EC2 instance type (
--aws-instance-type
)
For a comprehensive list of these flags, please run:
./konvoy-image build --help
Using Override Files
Another option is by creating a file with the parameters to be overridden and specify the --overrides
flag as shown below:
./konvoy-image build images/<builder-type>/<os>-<version>.yaml --overrides overrides.yaml
While CLI flags can be used in combination with override files, CLI flags take priority over any override files.
Create a Custom Override Examples
AWS Example:
For example, when using the AWS Packer builder to override an image with another 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
.
Create your AWS override file overrides-source-ami.yaml
:
---
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 aws images/ami/centos-7.yaml --overrides override-source-ami.yaml
vSphere Example:
Create your vSphere overrides file overrides/vcenter.yaml
and fill in the relevant details for your vSphere environment:
---
packer:
vcenter_server: <FQDN of your vcenter>
vsphere_username: <username for vcenter e.g. administrator@vsphere.local>
vsphere_password: <password for vcenter>
ssh_username: builder
ssh_password: <password for your VMs builder user>
linked_clone: false
cluster: <vsphere cluster to use>
datacenter: <vsphere datacenter to use>
datastore: <vsphere datastore to use for templates>
folder: <vsphere folder to store the template in>
insecure_connection: "true"
network: <a DHCP-enabled network in vcenter>
resource_pool: <vsphere resource pool to use>
After creating the override file for your source_ova
, pass your override file by using the --overrides
flag when building your image:
konvoy-image build images/ova/ubuntu-2004.yaml \
--overrides overrides/kube-version.yaml \
--overrides overrides/vcenter.yaml