Cluster API on OpenStack: Part 2 - Building CAPI Images

Cluster API on OpenStack: Part 2 - Building CAPI Images

December 28, 2025

CAPI requires VM images with Kubernetes components pre-installed. The image-builder project from Kubernetes SIGs provides tooling to create these images for various platforms, including OpenStack.

This is part 2 of the Cluster API on OpenStack series:

  1. Introduction and Architecture
  2. Building CAPI Images (this post)
  3. Deploying Workload Clusters
  4. Day-2 Operations

Prerequisites

You need a Linux machine with KVM support for local builds. On Ubuntu make sure git is installed:

sudo apt-get install -y git
git clone https://github.com/kubernetes-sigs/image-builder.git
cd image-builder/images/capi

# Install dependencies (Packer, Ansible, etc.)
make deps

# Add the .bin directory to PATH
export PATH=$PWD/.bin:$PATH

Build Directly in OpenStack

I prefer builing images remotely using an existing OpenStack instance as the build environment. This requires a base Ubuntu cloud image already uploaded to Glance:

# Set up OpenStack authentication
source ~/openrc.sh

# Create a variables file for OpenStack builder
cat > openstack-vars.json <<EOF
{
  "source_image": "ubuntu-24.04-cloud",
  "networks": "your-network-uuid",
  "flavor": "m1.medium",
  "floating_ip_network": "public",
  "kubernetes_deb_version": "1.32.0-1.1",
  "kubernetes_semver": "v1.32.0",
  "kubernetes_series": "v1.32",
  "image_visibility": "public"
}
EOF

# Install OpenStack-specific dependencies
make deps-openstack

# Build the image
PACKER_VAR_FILES=openstack-vars.json make build-openstack-ubuntu-2404

This spins up an instance, installs everything, creates a snapshot, and cleans up. The resulting image appears directly in Glance.

What’s Next

With images available in Glance, you’re ready to deploy workload clusters.