Skip to main content
Skip table of contents

Customize Packer Configuration

Although there are several parameters specified by default in the Packer templates for each provider, it is possible to override the default values.

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

Using Flags

One option is to execute KIB with specific flags to override the following values:

  1. the source AMI (--source-ami)

  2. AMI region (--ami-regions)

  3. AWS EC2 instance type (--aws-instance-type)

For a comprehensive list of these flags, please run:

CODE
./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:

CODE
./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.

DKP provides several default override files and explains how to create your own custom override files as well. Refer to whichever information you need:

Override Credentials in Packer

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.

AWS Example:

For example, when using the AWS Packer builder to override the credentials, set them under the packer key. This overrides the image search and forces the use of the specified credentials.

Create your override file overrides-packer-credentials.yaml:

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

After creating the override file for your credentials, pass your override file by using the --overrides flag when building our image:

CODE
./konvoy-image build aws images/ami/centos-7.yaml --overrides override-packer-credentials.yaml

Azure Example:

An Azure example would be the current base image description at images/azure/centos-79.yaml which is similar to the following:

CODE
---
# Example images/azure/centos-79.yaml
download_images: true
packer:
  distribution: "centos"  #offer
  distribution_version: "7_9-gen2"  #SKU
  image_publisher: "openlogic"
  image_version: "latest"
  ssh_username: "centos"
  
build_name: "centos-7"
packer_builder_type: "azure"
python_path: ""

or

vSphere Example:

A vSphere example would be the current base image description at images/vsphere/rhel-79.yaml which is similar to the following:

CODE
---
download_images: true
build_name: "rhel-79"
packer_builder_type: "vsphere"
guestinfo_datasource_slug: "https://raw.githubusercontent.com/vmware/cloud-init-vmware-guestinfo"
guestinfo_datasource_ref: "v1.4.0"
guestinfo_datasource_script: "{{guestinfo_datasource_slug}}/{{guestinfo_datasource_ref}}/install.sh"
packer:
  cluster: "zone1"
  datacenter: "dc1"
  datastore: "esxi-06-disk1"
  folder: "cluster-api"
  insecure_connection: "false"
  network: "Airgapped"
  resource_pool: "Users"
  template: "base-rhel-7"
  vsphere_guest_os_type: "rhel7_64Guest"
  guest_os_type: "rhel7-64"
  #goss params
  distribution: "RHEL"
  distribution_version: "7.9"

See Supported Operating Systems for details.

Next Topic

Add Custom Tags to your Image

JavaScript errors detected

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

If this problem persists, please contact our support.