5.6 - Lab 17¶
Objectives¶
- Unzip the Tanzu Kubernetes Grid Image Builder Files
- Load the OVF tool into the Image Builder Container Image
- Prepare the Image Builder Configuration
- Run Image Builder
Unzip the Tanzu Kubernetes Grid Image Builder Files¶
-
Using the terminal, navigate to the
Downloadsdirectory.cd ~/Downloads -
Unzip the Tanzu Kubernetes Grid Image Builder file.
unzip TKG-Image-Builder-for-Kubernetes-v1.19.9-master.zip -
Move the files to the
imagebuilderdirectory.mv TKG-Image-Builder-for-Kubernetes-v1.19.9-master/TKG-Image-Builder-for-Kubernetes-v1.19.9/ ~/Workspace/imagebuilder -
List the directory contents to verify that the files were copied.
ls -l ~/Workspace/imagebuilder/TKG-Image-Builder-for-Kubernetes-v1.19.9
Load the OVF tool into the Image Builder Container Image¶
-
Using the terminal, navigate to the imagebuilder directory.
cd ~/Workspace/imagebuilder -
Copy the OVF Tool file from the
Downloadsdirectory.cp ~/Downloads/VMware-ovftool-4.4.1-16812187-lin.x86_64.bundle ./ -
Open
Dockerfilein Visual Studio Code.code Dockerfile- Modify the following parameter.
- Save the file and close Visual Studio Code.
- Verify that the configuration file matches the reference configuration file.
checkconfig DockerfileWhen a configuration mismatch exists, Visual Studio Code opens the configuration file in the left panel and the reference configuration file in the right panel.
-
If a configuration mismatch exists, modify the configuration on the left to match the reference configuration on the right.
Differences are highlighted in red.
-
Save the file and close Visual Studio Code.
- Build the container image.
docker build . -t harbor.vclass.local/tkg/imagebuilder-byoi:v0.1.9
Prepare the Image Builder Configuration¶
-
Using the terminal, navigate to the
imagebuilderdirectory.cd ~/Workspace/imagebuilder -
Open
custom.jsonin Visual Studio Code.code custom.json-
Modify
custom.jsonby adding libnfs-utils to the extra_debs field."extra_debs": "\"libnfs-utils\""The field must be double-quoted.
The libnfs-utils package will be installed in the image.
-
Save the file and close Visual Studio Code.
- Verify that the configuration file matches the reference configuration file.
checkconfig custom.jsonWhen a configuration mismatch exists, Visual Studio Code opens the configuration file in the left panel and the reference configuration file in the right panel.
-
If a configuration mismatch exists, modify the configuration on the left to match the reference configuration on the right.
Differences are highlighted in red.
-
Save the file and close Visual Studio Code.
- Open
metadata.jsonin Visual Studio Code.
code metadata.json-
Modify
metadata.jsonby appending vclass.0 to the VERSION field."VERSION": "v1.19.9+vmware.2-vclass.0"This distinguishes the custom image version from the default TKG v1.19.9+vmware.2 version.
-
Save the file and close Visual Studio Code.
- Verify that the configuration file matches the reference configuration file.
checkconfig metadata.jsonWhen a configuration mismatch exists, Visual Studio Code opens the configuration file in the left panel and the reference configuration file in the right panel.
-
If a configuration mismatch exists, modify the configuration on the left to match the reference configuration on the right.
Differences are highlighted in red.
-
Save the file and close Visual Studio Code.
- Open
vsphere.jsonin Visual Studio Code.
code vsphere.json- Modify
vsphere.jsonwith the following vSphere environment details. - Save the file and close Visual Studio Code.
- Verify that the configuration file matches the reference configuration file.
checkconfig vsphere.jsonWhen a configuration mismatch exists, Visual Studio Code opens the configuration file in the left panel and the reference configuration file in the right panel.
-
If a configuration mismatch exists, modify the configuration on the left to match the reference configuration on the right.
Differences are highlighted in red.
-
Save the file and close Visual Studio Code.
-
Run Image Builder¶
-
Using the terminal, navigate to the
imagebuilderdirectory.cd ~/Workspace/imagebuilder -
Review the build script.
cat build.shThis script passes all the configuration files as parameters to the image builder container image.
The
build-node-ova-vsphere-ubuntu-2004command runs inside the container. -
Run the build script.
./build.shThe build process will take approximately 20 minutes to complete.
The generated OVA file is saved to the
outputdirectory. -
List the generated OVA files.
ls -l output/ubuntu-2004-kube-v1.19.9The OVA files display.