
Overview
Tanzu Build Service uses the open-source Cloud Native Build packs project to turn application source code into container images. Build Service executes reproducible builds that align with modern container standards, and additionally keeps image resources up-to-date. It does so by leveraging Kubernetes infrastructure with kpack, a Cloud Native Build packs Platform, to orchestrate the image lifecycle.
Why Tanzu Build Service (TBS)?
- Save time to re-build, re-test and re-deploy during patching hundreds of containers.
- It auto scans source code configuration and language and inject dependencies into docker image that will be required to compile and/or run the app on container/K8s.
- Maintain latest image in image registry.
- OCI docker image support, build and run anywhere!
Refer to official page to know about supported build packs and click here to access vmware docs on TBS.
Prepare the setup:
Install Docker
- Docker to be installed on bootstrap machine which can be your local workstation or any hosted vm of your choice. For this demo, I have used linux machine hosted on public cloud accessible through internet on port 22.
- Steps to install Docker can be found in: https://docs.docker.com/get-docker/
Docker Hub or any Image Registry
- Create a Docker Hub Account or you can use any image registry like Harbor or gcr or acr etc.. In this demo I have used Docker Hub.
Kubernetes Cluster
- Install Kubernetes, I have used TKGM K8s cluster on Azure, you can also use KIND(K8s in Docker) with Docker Desktop or any kubernetes cluster of your choice. Ensure you have set the context to appropriate K8 cluster where you are planning to deploy TBS. Since I used TKGm on Azure, I have set the context to TKGm workload cluster.
- Install the Tanzu CLI and Kubectl on bootstrap machine where you manage the K8s cluster. Steps to Install can be found in post
Pivnet CLI
https://network.pivotal.io/products/build-service/ – Signup is required to download the executable from Tanzu Network
https://network.pivotal.io/users/dashboard/edit-profile – To generate or view API token
Below pivnet CLI commands can be used or can be downloaded manually from Network pages to Install:
Note: https://network.tanzu.vmware.com/users/dashboard/eulas, refer to manually accept eula.
Additional tools: I know too many tools, but these are tiny and doesn’t take more than few mins.
Install below mentioned Carvel CLIs for your operating system. These can be found Tanzu Network pages:
- kapp is a deployment tool that allows users to manage Kubernetes resources in bulk.
- ytt is a templating tool that understands YAML structure.
- kbld is tool that builds, pushes, and relocates container images
- imgpkg is tool that relocates container images and pulls the release configuration files. Note: imgpkg 0.12.0 or higher is required for installation.
https://network.pivotal.io/users/dashboard/eulas
Accept EULA:
- https://network.pivotal.io/products/tbs-dependencies/
- https://network.pivotal.io/products/tanzu-java-buildpack/
- https://network.pivotal.io/products/tanzu-java-native-image-buildpack
- https://network.pivotal.io/products/tanzu-nodejs-buildpack/
- https://network.pivotal.io/products/tanzu-go-buildpack/
Create a TBS image
TBS will sync with two systems i.e., GitHub and Docker Hub (or any image registry).
- Auto Build: After every commit done to git repo, TBS automatically triggers a new build job and create the image.
- Manual Build: Here, we will have to execute the build command manually as given below.
Test Application with TBS image: