This topic describes how to verify that Knative Serving was successfully installed.

About Verifying Knative Serving

To verify that Knative Serving was successfully installed, create an example Knative service and test it.

The procedure below shows you how to create an example Knative service using the Cloud Native Runtimes sample app, hello-yeti. This sample is custom built for Cloud Native Runtimes and is stored in the VMware Harbor registry.

Note: If you do not have access to the Harbor registry, you can use the Hello World - Go sample app in the Knative documentation.

Prerequisites

Before you verify Knative Serving, you must have created the cnr-demo namespace and variable. See step 1 of Verifying Your Installation.

Test Knative Serving

To create an example Knative service and use it to test Knative Serving:

  1. If you are verifying on Tanzu Mission Control or vSphere 7.0 with Tanzu, then create a role binding in the cnr-demo namespace. Run:

    kubectl apply -n "${WORKLOAD_NAMESPACE}" -f - << EOF
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      name: ${WORKLOAD_NAMESPACE}-psp
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cnr-restricted
    subjects:
    - kind: Group
      name: system:serviceaccounts:${WORKLOAD_NAMESPACE}
    EOF
    
  2. Deploy the sample app using the kn CLI. Run:

    kn service create hello-yeti -n ${WORKLOAD_NAMESPACE} \
      --image projects.registry.vmware.com/tanzu_serverless/hello-yeti@sha256:17d640edc48776cfc604a14fbabf1b4f88443acc580052eef3a753751ee31652 --env TARGET='hello-yeti'
    

    If you are verifying on Tanzu Mission Control or vSphere 7.0 with Tanzu, then add --user 1001 to the command above to run it as a non-root user.

  3. Run one of the following commands to retrieve the external address for your ingress, depending on your IaaS:

    IaaS:
    • Tanzu Kubernetes Grid on AWS
    • Tanzu Mission Control on AWS
    • Amazon Elastic Kubernetes Service
    Run:
    export EXTERNAL_ADDRESS=$(kubectl get service envoy -n contour-external \
    --output 'jsonpath={.status.loadBalancer.ingress[0].hostname}')

    IaaS:
    • vSphere 7.0 on Tanzu
    • Tanzu Kubernetes Grid on vSphere/Azure/GCP
    • Tanzu Kubernetes Grid Integrated Edition
    • Tanzu Mission Control on vSphere
    • Azure Kubernetes Service
    • Google Kubernetes Engine
    Run:
    export EXTERNAL_ADDRESS=$(kubectl get service envoy -n contour-external \
    --output 'jsonpath={.status.loadBalancer.ingress[0].ip}')

    IaaS: Local Kubernetes Cluster:
    • Docker desktop
    • Kind
    • Minikube
    Run:
    export EXTERNAL_ADDRESS='localhost:8080' 
    And, on another terminal, set up port forwarding. Run:

    kubectl -n contour-external port-forward svc/envoy 8080:80 

  4. Connect to the app. Run:

    curl -H "Host: hello-yeti.${WORKLOAD_NAMESPACE}.example.com" ${EXTERNAL_ADDRESS}
    

    If external DNS is correctly configured, you can also visit the URL in a web browser.

    On success, you see a reply from our mascot, Carl the Yeti.

Delete the Example Knative Service

After verifying your serving installation, delete the example Knative service and unset the environment variable:

  1. Run:

    kn service delete hello-yeti -n ${WORKLOAD_NAMESPACE}
    unset EXTERNAL_ADDRESS
    
  2. If you created port forwarding in step 4 above, then terminate that process.

check-circle-line exclamation-circle-line close-line
Scroll to top icon