Build haproxy images
This how-to describes the process of building a custom base image for your infrastructure, instead of having to rely on the default simplestreams server.
The haproxy
image will be used for the cluster load balancer when using the development cluster template.
Table Of Contents
Requirements
- A locally configured Incus or Canonical LXD instance. The
image-builder
utility will use the default client credentials. - Go 1.23.0+
Build image-builder
binary
First, clone the cluster-api-provider-incus source repository:
git clone https://github.com/lxc/cluster-api-provider-incus
Then, build the image-builder
binary with:
make image-builder
Build haproxy
image
Use ./bin/image-builder haproxy --help
for a list of all available options.
./bin/image-builder haproxy --v=4 --output image-haproxy.tar.gz \
--image-alias haproxy/u24 \
--ubuntu-version 24.04
This will build a haproxy image based on Ubuntu 24.04, save it on the server as haproxy/u24
and also export it to the local file image-haproxy.tar.gz
Check image
incus image list haproxy
lxc image list haproxy
The output should look similar to this:
+-------------+--------------+--------+------------------------------------+--------------+-----------+-----------+-----------------------+
| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | SIZE | UPLOAD DATE |
+-------------+--------------+--------+------------------------------------+--------------+-----------+-----------+-----------------------+
| haproxy/u24 | 80aef76c0754 | yes | haproxy noble amd64 (202504280141) | x86_64 | CONTAINER | 148.15MiB | 2025/04/28 01:41 EEST |
+-------------+--------------+--------+------------------------------------+--------------+-----------+-----------+-----------------------+
Use the image in LXCCluster
Set spec.loadBalancer.instanceSpec.image.name
on the LXCCluster resource of your workload cluster. When launching the cluster, this will now use our custom image to provision the load balancer.