IBM Cloud cluster-api: building a CAPI image

Per the IBM Cloud Kubernetes cluster-api provider, I followed the raw instructions with some amendments.

Steps

  1. Provision an Ubuntu 20.04 image.

  2. Update the apt repository

$ apt update
  1. Install the dependencies (more than what’s in the instructions)
$ apt install qemu-kvm libvirt-daemon-system libvirt-clients virtinst cpu-checker libguestfs-tools libosinfo-bin make git unzip ansible python3-pip
  1. Clone the image-builder repo
$ git clone https://github.com/kubernetes-sigs/image-builder.git
  1. Change to the capi image
$ cd image-builder/images/capi
  1. Make the deps-raw to confirm everything is working.
$ make deps-raw
  1. Create the ubuntu-2004 image.
$ make build-qemu-ubuntu-2004

Once complete you’ll see:

==> qemu: Running post-processor: custom-post-processor (type shell-local)
==> qemu (shell-local): Running local shell script: /tmp/packer-shell078717884
Build 'qemu' finished after 12 minutes 8 seconds.

==> Wait completed after 12 minutes 8 seconds

==> Builds finished. The artifacts of successful builds are:
--> qemu: VM files in directory: ./output/ubuntu-2004-kube-v1.22.9
--> qemu: VM files in directory: ./output/ubuntu-2004-kube-v1.22.9
  1. Append the .qcow2 extension
$ mv ./output/ubuntu-2004-kube-v1.22.9/ubuntu-2004-kube-v1.22.9 ./output/ubuntu-2004-kube-v1.22.9/ubuntu-2004-kube-v1.22.9.qcow2

You can now upload the output to IBM Cloud Object Storage.

A couple quick tips:

  • If you see any warnings, you can get advanced details using export PACKER_LOG=1 which puts out the full packer logging. see Packer
  • KVM module not found indicates you are running in a nested KVM, you’ll have to swap out of the VM and enable nested KVM. Fedora: Docs
  • Adding a VM to VPC is documented here Console: customImage

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.