You can build custom machine images for Tanzu Kubernetes Grid to use as a VM template for the management and workload cluster nodes that it creates. Each custom machine image packages a base operating system (OS) version and a Kubernetes version, along with any additional customizations, into an image that runs on vSphere. Linux custom images can also run on AWS or Microsoft Azure infrastructure. A custom image must be based on the OS versions that are supported by Tanzu Kubernetes Grid. The base OS can be an OS that VMware supports but does not distribute, for example, Red Hat Enterprise Linux (RHEL) v8. To view the list of supported OSes, see Target Operating Systems.
This topic provides background on custom images for Tanzu Kubernetes Grid.
Note: To use a custom machine image for management cluster nodes, you need to deploy the management cluster with the installer interface, not from a configuration file.
To build custom machine images for Tanzu Kubernetes Grid cluster nodes, you use the container image from the upstream Kubernetes Image Builder project. Kubernetes Image Builder runs on your local workstation and uses the following:
For common combinations of OS version, Kubernetes version, and target infrastructure, Tanzu Kubernetes Grid provides default machine images. For example, one
ova-ubuntu-2004-v1.21.8+vmware.1-tkg image serves as the OVA image for Ubuntu v20.04 and Kubernetes v1.21.8 on vSphere.
For other combinations of OS version, Kubernetes version, and infrastructure, such as with the RHEL v8 OS or Windows, there are no default machine images, but you can build them.
If you build and use a custom image with the same OS version, Kubernetes version, and infrastructure that a default image already has, your custom image replaces the default. The Tanzu CLI then creates new clusters using your custom image, and no longer uses the default image, for that combination of OS version, Kubernetes version, and target infrastructure.
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 a machine image, it expects several things to be configured, installed, and accessible or running, including:
kubectlspecified in the cluster manifest.
kubeadm join. You must include any images that are not published and must be pulled locally, as with VMware-signed images.
cloud-initconfigured to accept bootstrap instructions.
For information about how to build images, see the following topics.