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!
Prepare the setup:
- 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.
- 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
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.
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: