Skip to content

Latest commit

 

History

History
138 lines (104 loc) · 4.77 KB

README.md

File metadata and controls

138 lines (104 loc) · 4.77 KB

tce-tutorial-1

Deploying my first application via Tanzu Community Edition

This page walks you through the following steps:

  1. Install Tanzu Community Edition.
  2. Install Knative CLI
  3. Create an Unmanaged cluster.
  4. Install kpack package.
  5. Install kpack-dependencies package.
  6. Build an OCI compliant image and Publish the image to your registry.
  7. Install and Deploy with Knative serving.

Step 1 - Install Tanzu Community Edition

brew install vmware-tanzu/tanzu/tanzu-community-edition

Step 1a. Once the installation is completed, initialize all plugins required by Tanzu Community Edition

/opt/homebrew/Cellar/tanzu-community-edition/v0.12.1/libexec/configure-tce.sh

Step 2 - Create an Unmanaged Cluster in Tanzu Community Edition

tanzu unmanaged-cluster create <CLUSTER_NAME> -p 80:80 -p 443:443

Step 3 - Create Registry Secret (This is required to publish images to your registry)

kubectl create secret docker-registry tutorial-registry-credentials \
--docker-username=my-dockerhub-username \
--docker-password=my-dockerhub-password \
--docker-server=https://index.docker.io/v1/ \
-n default

Step 4 - Install Kpack package

tanzu package install kpack \
--package-name kpack.community.tanzu.vmware.com \
-f config/kpack/kpack-values.yaml \
--version 0.5.3 
tanzu package install kpack-dependencies \
--package-name kpack-dependencies.community.tanzu.vmware.com \
-f config/kpack_dependencies/kpack-dependencies-values.yaml \
--version 0.0.27 

Step 6 - Install Contour package

tanzu package install contour \
--package-name contour.community.tanzu.vmware.com \
-f config/contour/contour-values.yaml \
--version 1.20.1

Step 7 - Install Knative Serving package

tanzu package install knative-serving \
--package-name knative-serving.community.tanzu.vmware.com \
-f config/knative_serving/knative-serving-values.yaml \
--version 1.0.0

Step 8 - Verify kpack, kpack-dependencies and knative-serving packages are installed, and status is "Reconcile succeeded"

tanzu package installed list -A

9. Verify kpack-dependencies are installed on your cluster

kubectl get clusterstore -n default
kubectl get clusterstack -n default
kubectl get clusterbuilder -n default

Building our OCI compliant image

1. Create Service Account

This service account is used to reference the registry secret created in prerequisite step 1 using the manifest service-account.yaml file.

kubectl apply -f service-account.yaml

Step 2 - Build OCI Image and Publish

The image.yaml manifest file defines your image source, builder and tag needed to build and publish your OCI image. To learn how cloud native build packs work visit BuildPacks Docs

Make sure you replace <DOCKER_USERNAME> with your username

Apply the image to your cluster

kubectl apply -f image.yaml

Step 2a - View the logs of how kpack builds the image

kubectl logs hello-world-build-1-build-pod -c detect
kubectl logs hello-world-build-1-build-pod -c prepare
kubectl logs hello-world-build-1-build-pod -c build
kubectl logs hello-world-build-1-build-pod -c export

Step 2b - Get the latest image built by Kpack and make sure READY is True

kubectl get images hello-world

Step 3 - Deploy your application to our cluster using knative. (Note your image will be different)

To learn more on Knative visit Knative Docs

kn service create hello-world \
--image index.docker.io/ynamadi676/tutorial1@sha256:3889ad138b7739159a015e9e71d810fccf6e707186a3412a5917ea82f36313ad \
--pull-secret tutorial-registry-credentials

Step 3a - Verify you are able to access the deployed image

open -a Safari.app "http://hello-world.default.127-0-0-1.nip.io/"