This procedure walks you through building a Linux (Ubuntu) custom machine image to use when creating class-based clusters on vSphere. It is divided into the following sections:
To build a Linux custom machine image for plan-based (legacy) clusters, see Linux Custom Machine Images (Legacy). For more information about cluster types in Tanzu Kubernetes Grid, see Workload Cluster Types.
To build a Linux custom machine image, you need:
kubectl
govc
CLIIn this step, you retrieve the OS image version that is associated with the default Ubuntu OVA for the Kubernetes version that you want to use for your custom image. You will assign this OS image version to your custom image in the Build a Linux Image step below.
To retrieve the OS image version, do one of the following depending on your use case:
If you have a running management cluster that was created using the default Kubernetes version for the current Tanzu Kubernetes Grid version, you can retrieve the OS image version from the cluster:
Set your kubectl
context to the management cluster.
From the list of available TKrs, choose the Tanzu Kubernetes Release (TKr) for the Kubernetes version that you want to use for you custom image. For example, v1.25.7---vmware.1-tkg.1
. To list available TKrs, run:
kubectl get tkr
Open the TKr and record the osImages
property. This property specifies the names of OSImage
objects associated with the TKr.
List OSImage
objects in Kubernetes:
kubectl get osimages
In the output, find the OSImage
object listing that matches the TKr osImages
name for the default Ubuntu OVA.
Record the NAME
property of the OSImage
listing and replace its embedded ---
with a +
character. For example, v1.25.7+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e
.
If you do not have a running management cluster that was created using the default Kubernetes version for the current Tanzu Kubernetes Grid version, you can retrieve the OS image version directly from the default Ubuntu OVA, either locally or from vSphere:
To retrieve the OS image version locally:
.ofv
file.In the .ofv
file, search for the OVA VERSION
property and record its value. For example, v1.25.7+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e
. The property looks similar to the following:
<Property ovf:key="VERSION" ovf:type="string" ovf:userConfigurable="false" ovf:value="v1.25.7+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e"/>
If you already uploaded the default Ubuntu OVA for your target Kubernetes version to vSphere, you can alternatively retrieve the OS image version by inspecting the OVA VM properties in the vSphere UI or by using the govc
CLI. To use this method, retrieve the OS image version before converting the OVA VM to a template.
To retrieve the OS image version from the vSphere UI:
v1.25.7+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e
.To retrieve the OS image version using the govc
CLI, run the govc vm.info
command. For example:
govc vm.info -json /dc0/vm/ubuntu-2004-kube-v1.25.7+vmware.1-tkg.1 | jq
In the output, search for "Id": "VERSION"
and record the value of the "DefaultValue"
property. For example:
{
"Key": 10,
"ClassId": "",
"InstanceId": "",
"Id": "VERSION",
"Category": "Cluster API Provider (CAPI)",
"Label": "VERSION",
"Type": "string",
"TypeReference": "",
"UserConfigurable": false,
"DefaultValue": "v1.25.7+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e",
"Value": "",
"Description": ""
}
To build a Linux image:
Complete the Build a Linux Image steps for plan-based clusters on vSphere, but with the following exception. When setting the version string for your custom image in metadata.json
, set it to the value that you retrieved in the Retrieve the OS Image Version step above, instead of v1.25.7+vmware.1-myorg.0
as recommended in the Build a Linux Image section. For example:
{
"VERSION": "v1.25.7+vmware.1-tkg.1-765d418b72c247c2310384e640ee075e"
}
After completing the steps in the Build a Linux Image section, return to this page and proceed to Upload the Linux Image to vSphere below.
After completing the steps in the Build a Linux Image section, do the following:
You can now deploy management and workload clusters using your custom image. For instructions, see: