How to build the machine boot images
VPC
Example
To build an image using a specific version of Kubernetes use the “PACKER_FLAGS” environment variable like in the example below:
# Clone the image-builder repository
$ git clone https://github.com/kubernetes-sigs/image-builder.git
$ cd image-builder/images/capi
$ PACKER_FLAGS="--var 'kubernetes_rpm_version=1.26.2-0' --var 'kubernetes_semver=v1.26.2' --var 'kubernetes_series=v1.26' --var 'kubernetes_deb_version=1.26.2-00'" make build-qemu-ubuntu-2004
PowerVS
Example
Compose the user-variables.json
file containing the information for the PowerVS
{
"account_id": "",
"apikey": "",
"capture_cos_access_key": "",
"capture_cos_bucket": "",
"capture_cos_region": "",
"capture_cos_secret_key": "",
"key_pair_name": "",
"kubernetes_deb_version": "",
"kubernetes_rpm_version": "",
"kubernetes_semver": "",
"kubernetes_series": "",
"region": "",
"service_instance_id": "",
"ssh_private_key_file": "",
"zone": "",
"dhcp_network": "false"
}
account_id
: IBM Cloud account IDapikey
: IBM Cloud API Keycapture_cos_access_key
: IBM Cloud Object Storage(COS) access key where the image will be exportedcapture_cos_bucket
: IBM Cloud Object Storage(COS) bucket namecapture_cos_region
: IBM Cloud Object Storage(COS) bucket regioncapture_cos_secret_key
: IBM Cloud Object Storage(COS) secret keykey_pair_name
: SSH key name present in the PowerVSkubernetes_deb_version
: Kubernetes deb version, e.g: 1.24.2-00kubernetes_rpm_version
: Kubernetes RPM package version, e.g: 1.24.2-0kubernetes_semver
: e.g: v1.24.2kubernetes_series
: e.g: v1.24region
: PowerVS region, e.g: osaservice_instance_id
: PowerVS service instance IDssh_private_key_file
: Path to the SSH private key file used to connect to the vm while image preparation, e.g: /Users/manjunath/.ssh/id_rsazone
: PowerVS zone, e.g: osa21dhcp_network
: Set totrue
if the image has to be built with DHCP support
Note:
- When setting
dhcp_network: true
, you need to build an OS image with certain network settings using pvsadm tool and replace the fields with the custom image details.- Clone the image-builder repo and run
make build
commands from a system where the DHCP private IP can be reached and SSH able(you can use a transit gateway with connections added for VPC and PowerVS workspace and build the image from a virtual server instance in VPC).
# Clone the image-builder repository
$ git clone https://github.com/kubernetes-sigs/image-builder.git
$ cd image-builder/images/capi
$ ANSIBLE_SSH_ARGS="-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" PACKER_VAR_FILES=user-variables.json make build-powervs-centos-8