This topic describes how to use Application Live View when scaling Knative apps or developer workloads in Tanzu Application Platform.

Application Live View is focused on monitoring apps for a live window and does not apply to any of the apps that are scaled down to zero. The intended behavior for Knative apps is to keep track of revisions to allow you to rollback easily, but also scale all of the unused revision instances down to zero to keep resource consumption low.

You can configure Knative apps to set to 1 so that App Live View can still observe app instance. This ensures that there is at least one instance of the latest revision, while still scaling down the older instances.

You can configure any app in Tanzu Application Platform using the Workload resource. To scale a Knative app, add the annotation in the Workload and set it to the value you want. For Application Live View to observe an app and have at least one instance of the latest revision, set = "1".

The annotations or labels in the Workload get propagated through the Tanzu Application Platform supply chain as follows:

Workload > PodIntent > ConfigMap > Push Config > to repository/registry > git-repository/imagerepository picks the Config from repository/registry > kapp-ctrl deploys and knative runs the config > final pod running on the Kubernetes cluster.

Configure the developer workload in Tanzu Application Platform

The following YAML is an example Workload that adds the annotation = "1" to set the minimum scale for the spring-petclinic app:

kind: Workload
  name: spring-petclinic
  namespace: default
  labels: tanzu-java-web-app web
  annotations: "1"
        branch: main

Deploy the workload

To deploy the workload, run:

kapp -y deploy -n default -a workloads -f workloads.yaml

Verify the annotation has propagated through the Supply Chain

To verify the annotation:

  1. Verify that the workload build is successful by ensuring that SUCCEEDED is set to True:

    kubectl get builds
    NAME                         IMAGE                                                                                                                                                 SUCCEEDED
    spring-petclinic-build-1     True
  2. Verify the PodIntent of your workload by ensuring status.template.metadata.annotations shows the newly added annotation has propagated through the Supply Chain:

    kubectl get spring-petclinic -oyaml  
      - lastTransitionTime: "2021-12-03T15:14:33Z"
        status: "True"
        type: ConventionsApplied
      - lastTransitionTime: "2021-12-03T15:14:33Z"
        status: "True"
        type: Ready
      observedGeneration: 3
  3. Verify the ConfigMap was created for the app by ensuring spec.template.metadata.annotations shows the newly added annotation has propagated through the Supply Chain:

    kubectl describe configmap spring-petclinic
    Name:         spring-petclinic
    Namespace:    default
    Annotations:  <none>
    kind: Service
      name: spring-petclinic
      labels: tanzu-java-web-app web "1638455805474051000" v1.5a9384bd7b93ca74ef494c4dec2caa4b "false" run spring-petclinic
  4. Verify the running Knative application pod by ensuring annotations shows the newly added annotation on the Knative application pod:

    kubectl get pods -o yaml spring-petclinic-00002-deployment-77dbb85c65-cf7rn | grep annotations
      annotations: '{"apiVersion":"","kind":"Workload","metadata":{"annotations":{"":"1"},"labels":{"":"tanzu-java-web-app","":"web","":"1638455805474051000","":"v1.5a9384bd7b93ca74ef494c4dec2caa4b","":"false"},"name":"spring-petclinic","namespace":"default"},"spec":{"source":{"git":{"ref":{"branch":"main"},"url":""}}}}'

Your Knative app is now set to a minimum scale of one so that Application Live View can observe the instance of the app.

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