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
Downloads
directory.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
imagebuilder
directory.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
Downloads
directory.cp ~/Downloads/VMware-ovftool-4.4.1-16812187-lin.x86_64.bundle ./
-
Open
Dockerfile
in 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 Dockerfile
When 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
imagebuilder
directory.cd ~/Workspace/imagebuilder
-
Open
custom.json
in Visual Studio Code.code custom.json
-
Modify
custom.json
by 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.json
When 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.json
in Visual Studio Code.
code metadata.json
-
Modify
metadata.json
by 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.json
When 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.json
in Visual Studio Code.
code vsphere.json
- Modify
vsphere.json
with 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.json
When 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
imagebuilder
directory.cd ~/Workspace/imagebuilder
-
Review the build script.
cat build.sh
This script passes all the configuration files as parameters to the image builder container image.
The
build-node-ova-vsphere-ubuntu-2004
command runs inside the container. -
Run the build script.
./build.sh
The build process will take approximately 20 minutes to complete.
The generated OVA file is saved to the
output
directory. -
List the generated OVA files.
ls -l output/ubuntu-2004-kube-v1.19.9
The OVA files display.