VMware Application Catalog gives developers a private self-service registry of Bitnami open source containers that are continuously maintained to meet the IT governance needs of operators in each organization. Each container is continuously updated and comes with metadata proving the trustworthiness of the software within. This metadata includes:
VMware Application Catalog allows developers to build containers for production workloads in a faster and more secure manner. With VMware Application Catalog, developers can replace the containers and Helm charts they were maintaining for production workloads with IT-approved containers and charts built and maintained by VMware. These can be downloaded for local development, or they can be used in production. For development teams that rely on hand-built containers, VMware Application Catalog is a huge leap forward in efficiency, compliance, and better security.
That’s where this guide comes in. It walks you through the process of rebasing an existing application using VMware Application Catalog, showing you how to both rebuild and redeploy your application on Kubernetes using containers and Helm charts from the VMware Application Catalog. To illustrate the steps, it uses a simple React Web application served with Apache.
This guide makes the following assumptions:
NOTE: This guide uses the VMware Application Catalog demo environment, which includes pre-built catalogs containing a limited set of containers and Helm charts. However, the steps outlined below also hold true for fully-functional VMware Application Catalog environments. If you don’t have access to the VMware Application Catalog demo environment, you can request access or contact your VMware sales representative.
An application’s Dockerfile usually begins by specifying the base image for the container. For example, if your application uses the Bitnami Apache container as its base image, your Dockerfile will begin with a line similar to the one below:
To rebase your application using the VMware Application Catalog, you need to simply replace the previous line to reference a base image from the VMware Application Catalog instead. No other changes are needed to your application code.
Begin by selecting an appropriate base image. Follow the steps below:
Locate and select the base container you wish to use in the list of available applications. Click the “Details” link. In this example, select the Apache container image.
On the container detail page, note the container tags.
Once you have chosen the base image to use, rebuild your application container with that base image.
Begin by obtaining the source code for your application. If you’re using the example React application listed above, clone the corresponding Git repository on your development system, as shown below:
$ git clone https://github.com/pankajladhar/GFontsSpace.git
Change into the application source directory, download dependencies and build the project:
$ cd GFontsSpace $ yarn install $ yarn build
Create a Dockerfile that uses the Apache container image from the VMware Application Catalog by specifying the container tag in the first line. Then, add the built application to the Apache server’s document root (by default, this is configured as the /app directory):
FROM gcr.io/sys-2b0109it/demo/bitnami/apache:2.4-centos-7 COPY build /app
NOTE: Most container images in VMware Application Catalog are non-root container images. If your build process requires installation of system packages or modification of privileged configuration files, your Dockerfile must switch to a non-root user account first with the
USER root command.
Build the Docker image, replacing the USERNAME placeholder in the command below with your Docker Hub username:
$ docker build -t myapp .
Upload the Docker image to your container registry following your registry’s documentation. For example, to upload the image to Docker Hub, use the commands below and replace the USERNAME placeholder with your Docker Hub username.
$ docker login $ docker tag myapp USERNAME/myapp $ docker push USERNAME/myapp
Confirm that you see the image in your container registry before proceeding to the next step.
To deploy an application on Kubernetes using Helm, you first add the chart repository and then deploy a chart from that repository, passing it necessary inputs such as the container image to use, the Ingress hostname (if required), the type of service, and so on. For example, to deploy a custom application on a Kubernetes cluster using the Bitnami Apache Helm chart, you would execute commands similar to the below:
$ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm repo update $ helm install apache bitnami/apache \ --set image.registry=docker.io \ --set image.repository=USERNAME/myapp \ --set image.tag=latest \ --set service.type=LoadBalancer \ --set image.pullPolicy=Always
To redeploy your application on Kubernetes using the VMware Application Catalog, you need to simply use the VMware Application Catalog repository instead of the Bitnami chart repository, and deploy the application using a chart from there. No other changes are needed to your deployment infrastructure.
To see how this works, use the Apache Helm chart from the VMware Application Catalog to deploy the React application container image built in the previous step.
Locate and select the Helm chart you wish to use. Click the “Details” link. In this example, select the Apache chart.
Use the example commands shown on the detail page to deploy the React application using the Apache Helm chart. Modify the example commands to reflect your registry and repository credentials.
For example, if your application image is in a Docker Hub registry, use the commands below and replace the USERNAME placeholder with your Docker Hub username and the REPOSITORY placeholder with a reference to your VMware Application Catalog chart repository.
export HELM_EXPERIMENTAL_OCI=1 helm registry login registry.pivotal.io/tac-for-tanzu-advanced/charts helm install oci://registry.pivotal.io/tac-for-tanzu-advanced/charts/mysql --version 9.4.3 --generate-name \ --set image.registry=docker.io \ --set image.repository=USERNAME/myapp \ --set image.tag=latest \ --set service.type=LoadBalancer \ --set image.pullPolicy=Always
If you wish to access the application externally through a domain name and you have installed the NGINX Ingress controller, use these commands instead and replace the DOMAIN placeholder with your domain name:
export HELM_EXPERIMENTAL_OCI=1 helm registry login registry.pivotal.io/tac-for-tanzu-advanced/charts helm install oci://registry.pivotal.io/tac-for-tanzu-advanced/charts/mysql --version 9.4.3 --generate-name \ --set image.registry=docker.io \ --set image.repository=USERNAME/myapp \ --set image.tag=latest \ --set image.pullPolicy=Always \ --set ingress.enabled=true \ --set ingress.hosts.name=DOMAIN
This will create a pod within the cluster for the Apache service.
NOTE: See the complete list of supported parameters for the Apache Helm chart.
Once the chart has been installed, you will see some information about the deployment. Run the helm status command to see deployment status:
$ helm status apache
Obtain the public IP address of the Apache service (if you deployed using a load balancer) using the command below:
$ kubectl get svc --namespace default apache
The external IP address of the Apache service can be obtained from the output of the previous command, as shown below:
Test the application by browsing to the service IP address, such as http://IP-ADDRESS/ or, if you used the NGINX Ingress controller, to the specified domain name. If you used the example application, here is a screenshot of what you should see:
You’ve now successfully rebased and redeployed your application on Kubernetes using a container and Helm chart from the VMware Application Catalog. As the example above demonstrates, apart from adapting your build and deployment process to reference the container images and charts in the VMware Application Catalog, there are no other changes needed for you to immediately start becoming productive with it.
To learn more about the topics discussed in this guide, use the links below: