Cluster API (CAPI) is built on the principles of immutable infrastructure. All nodes that make up a cluster are derived from a common template or machine image.

When CAPI creates a cluster from the machine image, the API expects several things to be pre-configured and installed, including:

  • The correct versions of kubeadm, kubelet and kubectl are installed as specified in the workload cluster manifest.
  • A container runtime, most often containerd, is installed and running.
  • All required images for kubeadm init and kubeadm join are either present or accessible. If the images are not published and must be pulled locally, as is the case for VMware-signed images, then you must include these required images when building your machine image.
  • cloud-init is installed and configured to accept bootstrap instructions.

Building Images for vSphere, Amazon EC2, and Azure

Each CAPI provider requires its own machine image format. The linked guides describe how to build machine images in the following formats:

  • Cluster API Provider AWS (CAPA)

    • AMI - Amazon Machine Image.
    • You build the machine images from AMIs that are published on Amazon EC2, such as official Ubuntu AMIs.
    • You build the machine image inside AWS and then store the resulting image in your AWS account in one or more regions.
    • See Build and Use Custom AMI Images on Amazon EC2.
  • Cluster API Provider vSphere (CAPV)

    • OVA - Open Virtualization Archive.
    • You build the machine images from the Linux distribution's original installation ISO.
    • You import the resulting OVA into a vSphere cluster, take a snapshot for fast cloning, and then mark the machine image as a vm template.
    • See Build and Use Custom OVA Images on vSphere.
  • Cluster API Provider Azure (CAPZ)

You can include additional software and configurations in your machine image during the build process based on your own custom specifications. Before making any modifications, consult with VMware CRE for best practices and recommendations.

Extending the Kubernetes Image Builder project

Image Builder is an official upstream Kubernetes project that is dedicated to building machine images. Image Builder uses the following processes to build images:

  • Uses Packer as a project base to begin building the machine image. Packer allows you to create machine images for current and future CAPI providers in a uniform and automated manner.
  • Uses Ansible to configure machines during the provisioning stage. Ansible allows you to use a common process for targeting multiple distribution families such as Ubuntu and CentOS.
  • Finally, Packer allows you to publish the machine image for use according to the provider you are using.
  • After publication, you can launch workload clusters using the new machine image by using the workload cluster manifests.
check-circle-line exclamation-circle-line close-line
Scroll to top icon