Azure Using Konvoy Image Builder
This procedure describes how to use the Konvoy Image Builder (KIB) to create a Cluster API compliant Azure Virtual Machine (VM) Image. The VM Image contains the base operating system you specify and all the necessary Kubernetes components. The Konvoy Image Builder uses variable overrides
to specify the base image and container images to use in your new Azure VM image.
DKP is configured to try and use the Azure Virtual Machine images created by the Cluster-API Azure project if you do not specify your own. However, the Cluster-API Azure project has stopped publishing these images for Kubernetes 1.27, so you now must use KIB for Azure to build a Virtual Machine Image for DKP 2.7. Explore the Customize your Image topic for more options.
For more information regarding using the image in creating clusters, refer to the Azure Create a New Cluster section of the documentation.
Prerequisites
Before you begin, you must:
Download the Konvoy Image Builder bundle for your version of DKP.
Check the Supported Kubernetes Version for your Provider.
Create a working
Docker
setup.
Extract the KIB Bundle
Extract the bundle and cd
into the extracted konvoy-image-bundle-$VERSION_$OS
folder. The bundled version of konvoy-image
contains an embedded docker
image that contains all the requirements for building.
The konvoy-image
binary and all supporting folders are also extracted. When extracted, konvoy-image
bind mounts the current working directory (${PWD}
) into the container to be used.
Ensure you have created a Service Principal and then create your custom image using KIB.
Build the Image
Run the konvoy-image
command to build and validate the image.
konvoy-image build azure --client-id ${AZURE_CLIENT_ID} --tenant-id ${AZURE_TENANT_ID} --overrides override-source-image.yaml images/azure/ubuntu-2004.yaml
By default, the image builder builds in the westus2
location. To specify another location set the --location
flag (shown in example below is how to change the location to eastus
):
konvoy-image build azure --client-id ${AZURE_CLIENT_ID} --tenant-id ${AZURE_TENANT_ID} --location eastus --overrides override-source-image.yaml images/azure/centos-7.yaml
When the command is complete, the image id is printed and written to the ./packer.pkr.hcl
file. This file has an artifact_id
field whose value provides the name of the image. You should then specify this image id when creating the cluster.
Image Gallery
By default Konvoy Image Builder will create a Resource Group, Gallery, and Image Name to store the resulting image in. To specify a specific Resource Group, Gallery, or Image Name flags may be specified:
--gallery-image-locations string a list of locations to publish the image (default same as location)
--gallery-image-name string the gallery image name to publish the image to
--gallery-image-offer string the gallery image offer to set (default "dkp")
--gallery-image-publisher string the gallery image publisher to set (default "dkp")
--gallery-image-sku string the gallery image sku to set
--gallery-name string the gallery name to publish the image in (default "dkp")
--resource-group string the resource group to create the image in (default "dkp")
When creating your cluster, you will then add this flag during the create process for your custom image: --compute-gallery-id "<Managed Image Shared Image Gallery Id>"
. See Create a New Azure Cluster for specific consumption of image commands.
The SKU and Image Name will default to the values found in the image YAML.
Ensure you have named the correct YAML file for your OS in the konvoy-image build
command.