This site will be decommissioned on December 31st 2024. After that date content will be available at techdocs.broadcom.com.

tanzu apps

Create, view, update, and delete application workloads on any Kubernetes cluster that has the Tanzu Application Platform (commonly known as TAP) components installed. For more information see Overview of Tanzu Apps CLI plug-in in the TAP documentation.

Installation

To access this command group, you must install the Tanzu CLI by following the instructions in Accepting Tanzu Application Platform EULAs and Installing Tanzu CLI in the Tanzu Application Platform documentation.

Usage

CLI plugin: apps | Plugin version: v0.12.1 | Target: kubernetes

Syntax:

tanzu kubernetes apps [command]

Aliases

apps, app

Available Commands

cluster-supply-chain patterns for building and configuring workloads
workload             Workload lifecycle management

Flags

    --context name      name of the kubeconfig context to use (default is current-context defined by kubeconfig)
-h, --help              help for apps
    --kubeconfig file   kubeconfig file (default is $HOME/.kube/config)
    --no-color          deactivate color, bold, animations, and emoji output
-v, --verbose int32     number for the log level verbosity (default 1)

tanzu apps cluster-supply-chain

Usage

tanzu kubernetes apps cluster-supply-chain [command]

Aliases

cluster-supply-chain, cluster-supply-chains, clustersupplychain, clustersupplychains, csc

Available Commands

get         Get details from a cluster supply chain
list        table listing of cluster supply chains

Flags

-h, --help   help for cluster-supply-chain

tanzu apps cluster-supply-chain get

Gets details from a cluster supply chain.

Usage

tanzu kubernetes apps cluster-supply-chain get <name> [flags]

Examples

The default view displays the status of the supply chain, and the selectors that a workload must match so it is taken by that supply chain.

For example:

tanzu apps cluster-supply-chain get source-to-url
---
# source-to-url: Ready
---
Supply Chain Selectors
   TYPE          KEY                                   OPERATOR   VALUE
   expressions   apps.tanzu.vmware.com/workload-type   In         web
   expressions   apps.tanzu.vmware.com/workload-type   In         server
   expressions   apps.tanzu.vmware.com/workload-type   In         worker

This output indicates the attributes a workload needs to be selected by the source-to-url supply chain on the target cluster. For example:

  • The workload must have the --type flag value of web, server, or worker.
  • Or, if expressed through workload.yaml, the Workload.metadata.labels label apps.tanzu.vmware.com/workload-type must exist and have a value of web, server , or worker.

Another example is the testing/scanning pipeline, which has the tekton steps for testing and the scanning steps.

---
# source-test-scan-to-url: Ready
---
Supply Chain Selectors
   TYPE          KEY                                   OPERATOR   VALUE
   labels        apps.tanzu.vmware.com/has-tests                  true
   expressions   apps.tanzu.vmware.com/workload-type   In         web
   expressions   apps.tanzu.vmware.com/workload-type   In         server
   expressions   apps.tanzu.vmware.com/workload-type   In         worker

In this case, the workload must have both labels apps.tanzu.vmware.com/has-tests: true and apps.tanzu.vmware.com/workload-type set up as web, server, or worker to be selected for the supply chain.

Flags

-h, --help   help for get

tanzu apps cluster-supply-chain list

Usage

tanzu kubernetes apps cluster-supply-chain list [flags]

Flags

  -h, --help   help for list

Examples

The default view displays the name of the supply chain, whether it is ready or not, and its age.

For example:

tanzu apps clustersupplychain list
NAME                 READY   AGE
basic-image-to-url   Ready   11d
source-to-url        Ready   11d

To view details: "tanzu apps cluster-supply-chain get <name>"

tanzu apps workload

A workload may run as a knative service, Kubernetes deployment, or other runtime. Workloads can be grouped together with other related resources such as storage or credential objects as a logical application for easier management.

Workload configuration includes:

  • source code to build
  • runtime resource limits
  • environment variables
  • services to bind

Usage

tanzu kubernetes apps workload [command]

Available Commands

apply       Apply configuration to a new or existing workload
create      Create a workload with specified configuration
delete      Delete workload(s)
get         Get details from a workload
list        Table listing of workloads
tail        Watch workload related logs

Aliases

  workload, workloads, wld

tanzu apps workload apply

Create and update workloads that are deployed in a cluster through a supply chain.

The tanzu apps workload apply and tanzu apps workload create commands have the same behavior and flags with the following exceptions:

  • The tanzu apps workload create command fails if a workload with the same name preexists on the target cluster.
  • The --update-strategy flag is only supported by tanzu apps workload apply because tanzu apps workload create doesnโ€™t support updating existing workloads.

Usage

tanzu kubernetes apps workload apply [name] [flags]

Example

In the output of the tanzu apps workload apply command, the specification for the workload is shown in YAML file format.

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    git:
     12 + |      ref:
     13 + |        tag: tap-{{ vars.tap_version }}
     14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     15 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:
๐Ÿ‘ Created workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"

In the first section, the definition of workload is displayed. Itโ€™s followed by a dialog box asking whether the workload should be created or updated. In the last section, if a workload is created or updated, some hints are displayed about the next steps.

Flags

--annotation

Sets the annotations to be applied to the workload. To specify more than one annotation set the flag multiple times. These annotations are passed as parameters to be processed in the supply chain.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web --annotation tag=tap-{{ vars.tap_version }} --annotation name="Tanzu Java Web"
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: default
    9 + |spec:
   10 + |  params:
   11 + |  - name: annotations
   12 + |    value:
   13 + |      name: Tanzu Java Web
   14 + |      tag: tap-{{ vars.tap_version }}
   15 + |  source:
   16 + |    git:
   17 + |      ref:
   18 + |        tag: tap-{{ vars.tap_version }}
   19 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   20 + |    subPath: tanzu-java-web-app

To delete an annotation, use - after its name.

Example

tanzu apps workload apply tanzu-java-web-app --annotation tag-
๐Ÿ”Ž Update workload:
...
10, 10   |  params:
11, 11   |  - name: annotations
12, 12   |    value:
13, 13   |      name: Tanzu Java Web
14     - |      tag: tap-{{ vars.tap_version }}
15, 14   |  source:
16, 15   |    git:
17, 16   |      ref:
18, 17   |        tag: tap-{{ vars.tap_version }}
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

-a

This is the application the workload is part of. This is part of the workload metadata section.

Example

tanzu apps workload apply tanzu-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web --app tanzu-java-web-app

   Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    app.kubernetes.io/part-of: tanzu-java-web-app
    7 + |    apps.tanzu.vmware.com/workload-type: web
    8 + |  name: tanzu-app
    9 + |  namespace: default
   10 + |spec:
   11 + |  source:
   12 + |    git:
   13 + |      ref:
   14 + |        tag: tap-{{ vars.tap_version }}
   15 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   16 + |    subPath: tanzu-java-web-app
  Do you want to create this workload? [yN]:
  Created workload "tanzu-app"

To see logs:   "tanzu apps workload tail tanzu-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-app"

--build-env

Sets environment variables to use in the build phase by the build resources in the supply chain.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web --build-env JAVA_VERSION=1.8
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  build:
     11 + |    env:
     12 + |    - name: JAVA_VERSION
     13 + |      value: "1.8"
     14 + |  source:
     15 + |    git:
     16 + |      ref:
     17 + |        tag: tap-{{ vars.tap_version }}
     18 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     19 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

To delete a build environment variable, use - after its name.

Example

tanzu apps workload apply tanzu-java-web-app --build-env JAVA_VERSION-
๐Ÿ”Ž Update workload:
...
   6,  6   |    apps.tanzu.vmware.com/workload-type: web
   7,  7   |  name: tanzu-java-web-app
   8,  8   |  namespace: default
   9,  9   |spec:
  10     - |  build:
  11     - |    env:
  12     - |    - name: JAVA_VERSION
  13     - |      value: "1.8"
  14, 10   |  source:
  15, 11   |    git:
  16, 12   |      ref:
  17, 13   |        tag: tap-{{ vars.tap_version }}
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

--debug

Sets the parameter variable debug to true in the workload.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --debug
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  params:
     11 + |  - name: debug
     12 + |    value: "true"
     13 + |  source:
     14 + |    git:
     15 + |      ref:
     16 + |        branch: main
     17 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     18 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--dry-run

Prepares all the steps to submit the workload to the cluster and stops before sending it, showing an output of the final structure of the workload.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web --build-env JAVA_VERSION=1.8 --param-yaml server=$'port: 8080\nmanagement-port: 8181' --dry-run
---
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
  creationTimestamp: null
  labels:
    apps.tanzu.vmware.com/workload-type: web
  name: tanzu-java-web-app
  namespace: default
spec:
  build:
    env:
    - name: JAVA_VERSION
      value: "1.8"
  params:
  - name: server
    value:
      management-port: 8181
      port: 8080
  source:
    git:
      ref:
        tag: tap-{{ vars.tap_version }}
      url: https://github.com/vmware-tanzu/application-accelerator-samples
    subPath: tanzu-java-web-app
status:
  supplyChainRef: {}

--env / -e

Sets the environment variables to the workload so the supply chain resources can use it to deploy the workload application.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web --env NAME="Tanzu Java App"
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  env:
     11 + |  - name: NAME
     12 + |    value: Tanzu Java App
     13 + |  source:
     14 + |    git:
     15 + |      ref:
     16 + |        tag: tap-{{ vars.tap_version }}
     17 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     18 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

To unset an environment variable, use - after its name.

tanzu apps workload apply tanzu-java-web-app --env NAME-
๐Ÿ”Ž Update workload:
...
   6,  6   |    apps.tanzu.vmware.com/workload-type: web
   7,  7   |  name: tanzu-java-web-app
   8,  8   |  namespace: default
   9,  9   |spec:
  10     - |  env:
  11     - |  - name: NAME
  12     - |    value: Tanzu Java App
  13, 10   |  source:
  14, 11   |    git:
  15, 12   |      ref:
  16, 13   |        tag: tap-{{ vars.tap_version }}
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

--file, -f

Sets the workload specification file to create the workload. This comes from any other workload specification passed by flags to the command set or overrides what is in the file. Another way to use this flag is by using - in the command to receive workload definition through stdin.

tanzu apps workload apply tanzu-java-web-app -f java-app-workload.yaml --param-yaml server=$'port: 9090\nmanagement-port: 9190'
๐Ÿ”Ž Create workload:
       1 + |---
       2 + |apiVersion: carto.run/v1alpha1
       3 + |kind: Workload
       4 + |metadata:
       5 + |  labels:
       6 + |    apps.tanzu.vmware.com/workload-type: web
       7 + |  name: tanzu-java-web-app
       8 + |  namespace: default
       9 + |spec:
      10 + |  build:
      11 + |    env:
      12 + |    - name: JAVA_VERSION
      13 + |      value: "1.8"
      14 + |  params:
      15 + |  - name: server
      16 + |    value:
      17 + |      management-port: 9190
      18 + |      port: 9090
      19 + |  source:
      20 + |    git:
      21 + |      ref:
      22 + |        tag: tap-{{ vars.tap_version }}
      23 + |      url: url: https://github.com/vmware-tanzu/application-accelerator-samples
      24 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--git-repo

The Git repository from which the workload is created. Specify one or more of the following:--git-tag, --git-commit, or --git-branch. If you set this flag to an empty string, the whole spec.source.git section is removed from workload definition.

For Git source, if all the flags are specified,--git-tag, --git-commit, and--git-branch, the revision to which the workload checkouts depends on the source controller.

--git-branch

The branch in a Git repository from where the workload is created. You can specify --git-commit and --git-tag with this flag. To unset, define as an empty string when applying a workload:--git-branch "".

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: default
    9 + |spec:
   10 + |  source:
   11 + |    git:
   12 + |      ref:
   13 + |        branch: main
   14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   15 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--git-tag

The tag in a Git repository from which the workload is created. To unset, define as an empty string when applying a workload: --git-tag "".

--git-commit

Commit in Git repository from where the workload is resolved. Either --git-branch or --git-tag can be specified with it too. To unset, define as an empty string when applying a workload:--git-commit "".

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-commit 1c4cf82e499f7e46da182922d4097908d4817320 --type web
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: default
    9 + |spec:
   10 + |  source:
   11 + |    git:
   12 + |      ref:
   13 + |        commit: 1c4cf82e499f7e46da182922d4097908d4817320
   14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   15 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--image / -i

Sets the OSI image to be used as the workload application source instead of a Git repository

Example

tanzu apps workload apply tanzu-java-web-app --image private.repo.domain.com/tanzu-java-web-app --type web
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  image: private.repo.domain.com/tanzu-java-web-app
โ“ Do you want to create this workload? [yN]: 

--label / -l

Sets the label to be applied to the workload. To specify more than one label, set the flag multiple times.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --label stage=production
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |    stage: production
      8 + |  name: tanzu-java-web-app
      9 + |  namespace: default
     10 + |spec:
     11 + |  source:
     12 + |    git:
     13 + |      ref:
     14 + |        branch: main
     15 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     16 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

To unset labels, use - after their name.

Example

tanzu apps workload apply tanzu-java-web-app --label stage-
๐Ÿ”Ž Update workload:
...
   3,  3   |kind: Workload
   4,  4   |metadata:
   5,  5   |  labels:
   6,  6   |    apps.tanzu.vmware.com/workload-type: web
   7     - |    stage: production
   8,  7   |  name: tanzu-java-web-app
   9,  8   |  namespace: default
  10,  9   |spec:
  11, 10   |  source:
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

--limit-cpu

The maximum CPU the workload pods are allowed to use.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --limit-cpu .2
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: default
    9 + |spec:
   10 + |  resources:
   11 + |    limits:
   12 + |      cpu: 200m
   13 + |  source:
   14 + |    git:
   15 + |      ref:
   16 + |        branch: main
   17 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   18 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--limit-memory

The maximum memory the workload pods are allowed to use.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --limit-memory 200Mi
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: default
    9 + |spec:
   10 + |  resources:
   11 + |    limits:
   12 + |      memory: 200Mi
   13 + |  source:
   14 + |    git:
   15 + |      ref:
   16 + |        branch: main
   17 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   18 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--live-update

Enable this to deploy the workload once, save changes to the code, and see those changes reflected in the workload running on the cluster.

Example

An example with a Spring Boot application:

  1. Clone the repository by running:

    git clone https://github.com/vmware-tanzu/application-accelerator-samples
    
  2. Change into the tanzu-java-web-app directory.

  3. In Tiltfile, first change the SOURCE_IMAGE variable to use your registry and project.
  4. At the very end of the file add:

    allow_k8s_contexts('your-cluster-name')
    
  5. Inside the directory, run:

    tanzu apps workload apply tanzu-java-web-app --live-update --local-path . -s
    gcr.io/my-project/tanzu-java-web-app-live-update -y
    

    Expected output:

    The files and directories listed in the .tanzuignore file are being excluded from the uploaded source code.
    Publishing source in "." to "gcr.io/my-project/tanzu-java-web-app-live-update"...
    ๐Ÿ“ฅ Published source
    
    ๐Ÿ”Ž Create workload:
       1 + |---
       2 + |apiVersion: carto.run/v1alpha1
       3 + |kind: Workload
       4 + |metadata:
       5 + |  name: tanzu-java-web-app
       6 + |  namespace: default
       7 + |spec:
       8 + |  params:
       9 + |  - name: live-update
      10 + |    value: "true"
      11 + |  source:
      12 + |    image: gcr.io/my-project/tanzu-java-web-app-live-update:latest@sha256:3c9fd738492a23ac532a709301fcf0c9aa2a8761b2b9347bdbab52ce9404264b
    
    ๐Ÿ‘ Created workload "tanzu-java-web-app"
    
    To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
    To get status: "tanzu apps workload get tanzu-java-web-app"
    
    
  6. Run Tilt to deploy the workload.

    tilt up
    
    Tilt started on http://localhost:10350/
    v0.23.6, built 2022-01-14
    
    (space) to open the browser
    (s) to stream logs (--stream=true)
    (t) to open legacy terminal mode (--legacy=true)
    (ctrl-c) to exit
    Tilt started on http://localhost:10350/
    v0.23.6, built 2022-01-14
    
    Initial Build โ€ข (Tiltfile)
    Loading Tiltfile at: /path/to/repo/tanzu-java-web-app/Tiltfile
    Successfully loaded Tiltfile (1.500809ms)
    tanzu-java-wโ€ฆ โ”‚
    tanzu-java-wโ€ฆ โ”‚ Initial Build โ€ข tanzu-java-web-app
    tanzu-java-wโ€ฆ โ”‚ WARNING: Live Update failed with unexpected error:
    tanzu-java-wโ€ฆ โ”‚   Cannot extract live updates on this build graph structure
    tanzu-java-wโ€ฆ โ”‚ Falling back to a full image build + deploy
    tanzu-java-wโ€ฆ โ”‚ STEP 1/1 โ€” Deploying
    tanzu-java-wโ€ฆ โ”‚      Objects applied to cluster:
    tanzu-java-wโ€ฆ โ”‚        โ†’ tanzu-java-web-app:workload
    tanzu-java-wโ€ฆ โ”‚
    tanzu-java-wโ€ฆ โ”‚      Step 1 - 8.87s (Deploying)
    tanzu-java-wโ€ฆ โ”‚      DONE IN: 8.87s
    tanzu-java-wโ€ฆ โ”‚
    tanzu-java-wโ€ฆ โ”‚
    tanzu-java-wโ€ฆ โ”‚ Tracking new pod rollout (tanzu-java-web-app-build-1-build-pod):
    tanzu-java-wโ€ฆ โ”‚      โ”Š Scheduled       - (โ€ฆ) Pending
    tanzu-java-wโ€ฆ โ”‚      โ”Š Initialized     - (โ€ฆ) Pending
    tanzu-java-wโ€ฆ โ”‚      โ”Š Ready           - (โ€ฆ) Pending
    ...
    

--local-path

Sets the path to a source in the local machine from where the workload creates an image to use as an application source. The local path can be a directory, a JAR, a ZIP, or a WAR file. Java/Spring Boot compiled binaries are also supported. This flag must be used with --source-image flag.

If Java/Spring compiled binary is passed instead of source code, the command takes less time to apply the workload because the build pack skips the compiling steps and start uploading the image.

When working with local source code, you can exclude files from the source code to be uploaded within the image by creating a file .tanzuignore at the root of the source code. The .tanzuignore file contains a list of file paths to exclude from the image including the file itself. The directories must not end with the system path separator (/ or \). If the file contains directories that are not in the source code, they are ignored. Lines starting with a # hashtag are also ignored.

--maven-artifact

This artifact is an output of a Maven project build. This flag must be used with --maven-version and --maven-group.

Example

tanzu apps workload apply petc-mvn --maven-artifact petc --maven-version 2.6.1 --maven-group demo.com
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  name: petc-mvn
      6 + |  namespace: default
      7 + |spec:
      8 + |  params:
      9 + |  - name: maven
     10 + |    value:
     11 + |      artifactId: petc
     12 + |      groupId: demo.com
     13 + |      version: 2.6.1
โ“ Do you want to create this workload? [yN]:

--maven-group

This group identifies the project across all other Maven projects.

--maven-type

This specifies the type of artifact that the Maven project produces. This flag is optional and is set by default as jar by the supply chain.

--maven-version

Definition of the current version of the Maven project.

--source-image, -s

Registry path where the local source code is uploaded as an image.

Example

tanzu apps workload apply spring-pet-clinic --local-path /home/user/workspace/spring-pet-clinic --source-image gcr.io/spring-community/spring-pet-clinic --type web
โ“ Publish source in "/home/user/workspace/spring-pet-clinic" to "gcr.io/spring-community/spring-pet-clinic"? It might be visible to others who can pull images from that repository Yes
The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "/home/user/workspace/spring-pet-clinic" to "gcr.io/spring-community/spring-pet-clinic"...
๐Ÿ“ฅ Published source

๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: spring-pet-clinic
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    image:gcr.io/spring-community/spring-pet-clinic:latest@sha256:5feb0d9daf3f639755d8683ca7b647027cfddc7012e80c61dcdac27f0d7856a7
โ“ Do you want to create this workload? [yN]:

--namespace, -n

Specifies the namespace in which the workload is created or updated in.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --namespace my-namespace
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: my-namespace
    9 + |spec:
   10 + |  source:
   11 + |    git:
   12 + |      ref:
   13 + |        branch: main
   14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
  15 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--output, -o

Retrieves a workload after itโ€™s applied in the specified format; yaml, yml, json. If used with the --yes flag, all prompts are skipped and it only returns the workload definition. Use with the --wait or --tail flag to return the workload with its status.

Example

tanzu apps workload apply rmq-sample-app --git-repo https://github.com/jhvhs/rabbitmq-sample --git-branch main --service-ref "rmq=rabbitmq.com/v1beta1:RabbitmqCluster:example-rabbitmq-cluster-1" --type web --output yaml
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: rmq-sample-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  serviceClaims:
     11 + |  - name: rmq
     12 + |    ref:
     13 + |      apiVersion: rabbitmq.com/v1beta1
     14 + |      kind: RabbitmqCluster
     15 + |      name: example-rabbitmq-cluster-1
     16 + |  source:
     17 + |    git:
     18 + |      ref:
     19 + |        branch: main
     20 + |      url: https://github.com/jhvhs/rabbitmq-sample
โ“ Do you want to create this workload? [yN]: y
๐Ÿ‘ Created workload "rmq-sample-app"

To see logs:   "tanzu apps workload tail rmq-sample-app --timestamp --since 1h"
To get status: "tanzu apps workload get rmq-sample-app"

---
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
  creationTimestamp: "2023-04-04T15:18:13Z"
  generation: 1
  labels:
    apps.tanzu.vmware.com/workload-type: web
  name: rmq-sample-app
  namespace: default
  resourceVersion: "184169566"
  uid: 6588d398-b803-47e3-b31a-23d9a1a633a9
spec:
  serviceClaims:
  - name: rmq
    ref:
      apiVersion: rabbitmq.com/v1beta1
      kind: RabbitmqCluster
      name: example-rabbitmq-cluster-1
  source:
    git:
      ref:
        branch: main
      url: https://github.com/jhvhs/rabbitmq-sample
status:
  supplyChainRef: {}

--param / -p

Additional parameters sent to the supply chain, the value is sent as a string. For complex YAML and JSON objects use --param-yaml.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --param port=9090 --param management-port=9190
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  params:
     11 + |  - name: port
     12 + |    value: "9090"
     13 + |  - name: management-port
     14 + |    value: "9190"
     15 + |  source:
     16 + |    git:
     17 + |      ref:
     18 + |        branch: main
     19 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     20 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

To unset parameters, use - after their name.

Example

tanzu apps workload apply tanzu-java-web-app --param port-
๐Ÿ”Ž Update workload:
...
   7,  7   |  name: tanzu-java-web-app
   8,  8   |  namespace: default
   9,  9   |spec:
  10, 10   |  params:
  11     - |  - name: port
  12     - |    value: "9090"
  13, 11   |  - name: management-port
  14, 12   |    value: "9190"
  15, 13   |  source:
  16, 14   |    git:
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

--param-yaml

Additional parameters to be sent to the supply chain, the value is sent as a complex object.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --param-yaml server=$'port: 9090\nmanagement-port: 9190'
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  params:
     11 + |  - name: server
     12 + |    value:
     13 + |      management-port: 9190
     14 + |      port: 9090
     15 + |  source:
     16 + |    git:
     17 + |      ref:
     18 + |        branch: main
     19 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     20 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

To unset parameters, use - after their name.

Example

tanzu apps workload apply tanzu-java-web-app --param-yaml server-
๐Ÿ”Ž Update workload:
...
   6,  6   |    apps.tanzu.vmware.com/workload-type: web
   7,  7   |  name: tanzu-java-web-app
   8,  8   |  namespace: default
   9,  9   |spec:
  10     - |  params:
  11     - |  - name: server
  12     - |    value:
  13     - |      management-port: 9190
  14     - |      port: 9090
  15, 10   |  source:
  16, 11   |    git:
  17, 12   |      ref:
  18, 13   |        branch: main
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

--registry-ca-cert

Refers to the path of the self-signed certificate needed for the custom/private registry. This is also populated with a default value through environment variables. If the environment variable TANZU_APPS_REGISTRY_CA_CERT is set, itโ€™s not necessary to use it in the command.

Example

tanzu apps workload apply my-workload --local-path . -s registry.url.nip.io/my-package/my-image --type web --registry-ca-cert path/to/cacert/mycert.nip.io.crt --registry-username my-username --registry-password my-password
โ“ Publish source in "." to "registry.url.nip.io/my-package/my-image"? It might be visible to others who can pull images from that repository Yes
Publishing source in "." to "registry.url.nip.io/my-package/my-image"...
๐Ÿ“ฅ Published source

๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: my-workload
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    image: registry.url.nip.io/my-package/my-image:latest@sha256:caeb7e3a0e3ae0659f74d01095b6fdfe0d3c4a12856a15ac67ad6cd3b9e43648
โ“ Do you want to create this workload? [yN]:

--registry-password

If credentials are needed, the user name and password values are set through the --registry-password flag. The value of this flag can also be specified through TANZU_APPS_REGISTRY_PASSWORD.

--registry-token

Used for token authentication in the private registry. This flag is set as TANZU_APPS_REGISTRY_TOKEN environment variable.

--registry-username

Often used with --registry-password to set private registry credentials. Can be provided using TANZU_APPS_REGISTRY_USERNAME environment variable to avoid setting it every time in the command.

--request-cpu

Refers to the minimum CPU the workload pods request to use.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --request-cpu .3
๐Ÿ”Ž Create workload:
    1 + |---
    2 + |apiVersion: carto.run/v1alpha1
    3 + |kind: Workload
    4 + |metadata:
    5 + |  labels:
    6 + |    apps.tanzu.vmware.com/workload-type: web
    7 + |  name: tanzu-java-web-app
    8 + |  namespace: default
    9 + |spec:
   10 + |  resources:
   11 + |    requests:
   12 + |      cpu: 300m
   13 + |  source:
   14 + |    git:
   15 + |      ref:
   16 + |        branch: main
   17 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
   18 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--request-memory

Refers to the minimum memory the workload pods are requesting to use.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --request-memory 300Mi
๐Ÿ”Ž Create workload:
     1 + |---
     2 + |apiVersion: carto.run/v1alpha1
     3 + |kind: Workload
     4 + |metadata:
     5 + |  labels:
     6 + |    apps.tanzu.vmware.com/workload-type: web
     7 + |  name: tanzu-java-web-app
     8 + |  namespace: default
     9 + |spec:
    10 + |  resources:
    11 + |    requests:
    12 + |      memory: 300Mi
    13 + |  source:
    14 + |    git:
    15 + |      ref:
    16 + |        branch: main
    17 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
    18 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

--service-account

Refers to the service account to associate with the workload. A service account provides an identity for a workload object.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --service-account petc-serviceaccount
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  serviceAccountName: petc-serviceaccount
     11 + |  source:
     12 + |    git:
     13 + |      ref:
     14 + |        branch: main
     15 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     16 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]:

To unset a service account, pass empty string.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --service-account ""
๐Ÿ”Ž Update workload:
...
  6,  6   |    apps.tanzu.vmware.com/workload-type: web
  7,  7   |  name: tanzu-java-web-app
  8,  8   |  namespace: default
  9,  9   |spec:
 10     - |  serviceAccountName: petc-serviceaccount
 11, 10   |  source:
 12, 11   |    git:
 13, 12   |      ref:
 14, 13   |        branch: main
...
โ“ Really update the workload "tanzu-java-web-app"? [yN]:

--service-ref

Binds a service to a workload to provide the information from a service resource to an application.

For more information, see Tanzu Application Platform documentation.

Example

tanzu apps workload apply rmq-sample-app --git-repo https://github.com/jhvhs/rabbitmq-sample --git-branch main --service-ref "rmq=rabbitmq.com/v1beta1:RabbitmqCluster:example-rabbitmq-cluster-1"
๐Ÿ”Ž Create workload:
     1 + |---
     2 + |apiVersion: carto.run/v1alpha1
     3 + |kind: Workload
     4 + |metadata:
     5 + |  name: rmq-sample-app
     6 + |  namespace: default
     7 + |spec:
     8 + |  serviceClaims:
     9 + |  - name: rmq
    10 + |    ref:
    11 + |      apiVersion: rabbitmq.com/v1beta1
    12 + |      kind: RabbitmqCluster
    13 + |      name: example-rabbitmq-cluster-1
    14 + |  source:
    15 + |    git:
    16 + |      ref:
    17 + |        branch: main
    18 + |      url: https://github.com/jhvhs/rabbitmq-sample
โ“ Do you want to create this workload? [yN]:

To delete service binding, use the service name followed by -.

Example

tanzu apps workload apply rmq-sample-app --service-ref rmq-
๐Ÿ”Ž Update workload:
...
   4,  4   |metadata:
   5,  5   |  name: rmq-sample-app
   6,  6   |  namespace: default
   7,  7   |spec:
   8     - |  serviceClaims:
   9     - |  - name: rmq
  10     - |    ref:
  11     - |      apiVersion: rabbitmq.com/v1beta1
  12     - |      kind: RabbitmqCluster
  13     - |      name: example-rabbitmq-cluster-1
  14,  8   |  source:
  15,  9   |    git:
  16, 10   |      ref:
  17, 11   |        branch: main
...
โ“ Really update the workload "rmq-sample-app"? [yN]:

--sub-path

Defines which path is used as the root path to create and update the workload.

Example

  • Git repository

    tanzu apps workload apply subpathtester --git-repo https://github.com/path-to-repo/my-repo --git-branch main --type web --sub-path my-subpath
    ๐Ÿ”Ž Create workload:
        1 + |---
        2 + |apiVersion: carto.run/v1alpha1
        3 + |kind: Workload
        4 + |metadata:
        5 + |  labels:
        6 + |    apps.tanzu.vmware.com/workload-type: web
        7 + |  name: subpathtester
        8 + |  namespace: default
        9 + |spec:
       10 + |  source:
       11 + |    git:
       12 + |      ref:
       13 + |        branch: main
       14 + |      url: https://github.com/path-to-repo/my-repo
       15 + |    subPath: my-subpath
    โ“ Do you want to create this workload? [yN]:
    
  • Local path

    • In the directory of the project you want to create the workload from

      tanzu apps workload apply my-workload --local-path . -s gcr.io/my-registry/my-workload-image --sub-path subpath_folder
      โ“ Publish source in "." to "gcr.io/my-registry/my-workload-image"? It might be visible to others who can pull images from that repository Yes
      Publishing source in "." to "gcr.io/my-registry/my-workload-image"...
      ๐Ÿ“ฅ Published source
      
      ๐Ÿ”Ž Create workload:
          1 + |---
          2 + |apiVersion: carto.run/v1alpha1
          3 + |kind: Workload
          4 + |metadata:
          5 + |  name: myworkload
          6 + |  namespace: default
          7 + |spec:
          8 + |  source:
          9 + |    image: gcr.io/my-registry/my-workload-image:latest@sha256:f28c5fedd0e902800e6df9605ce5e20a8e835df9e87b1a0aa256666ea179fc3f
         10 + |    subPath: subpath_folder
      โ“ Do you want to create this workload? [yN]:
      
      

--tail

Prints the logs of the workload creation in every step.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --tail
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    git:
     12 + |      ref:
     13 + |        branch: main
     14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     15 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]: y
๐Ÿ‘ Created workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"

Waiting for workload "tanzu-java-web-app" to become ready...
+ tanzu-java-web-app-build-1-build-pod โ€บ prepare
tanzu-java-web-app-build-1-build-pod[prepare] Build reason(s): CONFIG
tanzu-java-web-app-build-1-build-pod[prepare] CONFIG:
tanzu-java-web-app-build-1-build-pod[prepare]   + env:
tanzu-java-web-app-build-1-build-pod[prepare]   + - name: BP_OCI_SOURCE
tanzu-java-web-app-build-1-build-pod[prepare]   +   value: main/d381fb658cb435a04e2271ca85bd3e8627a5e7e4
tanzu-java-web-app-build-1-build-pod[prepare]   resources: {}
tanzu-java-web-app-build-1-build-pod[prepare]   - source: {}
tanzu-java-web-app-build-1-build-pod[prepare]   + source:
tanzu-java-web-app-build-1-build-pod[prepare]   +   blob:
tanzu-java-web-app-build-1-build-pod[prepare]   +     url: http://source-controller.flux-system.svc.cluster.local./gitrepository/default/tanzu-java-web-app/1c4cf82e499f7e46da182922d4097908d4817320.tar.gz
...
...
...

--tail-timestamp

Prints the logs of the workload creation in every step adding the time in which the log is occurring.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web --tail-timestamp
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    git:
     12 + |      ref:
     13 + |        branch: main
     14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     15 + |    subPath: tanzu-java-web-app
โ“ Do you want to create this workload? [yN]: y
๐Ÿ‘ Created workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"

Waiting for workload "tanzu-java-web-app" to become ready...
+ tanzu-java-web-app-build-1-build-pod โ€บ prepare
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.348418803-05:00 Build reason(s): CONFIG
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364719405-05:00 CONFIG:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364761781-05:00   + env:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364771861-05:00   + - name: BP_OCI_SOURCE
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364781718-05:00   +   value: main/d381fb658cb435a04e2271ca85bd3e8627a5e7e4
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364788374-05:00   resources: {}
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.364795451-05:00   - source: {}
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.365344965-05:00   + source:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.365364101-05:00   +   blob:
tanzu-java-web-app-build-1-build-pod[prepare] 2022-06-15T11:28:01.365372427-05:00   +     url: http://source-controller.flux-system.svc.cluster.local./gitrepository/default/tanzu-java-web-app/1c4cf82e499f7e46da182922d4097908d4817320.tar.gz
...
...
...

--type / -t

Sets the type of workload by adding the label apps.tanzu.vmware.com/workload-type, which is used as a matcher by supply chains. Use the TANZU_APPS_TYPE environment variable to have a default value for this flag.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-branch main --type web
๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: tanzu-java-web-app
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    git:
     12 + |      ref:
     13 + |        branch: main
     14 + |      url: https://github.com/vmware-tanzu/application-accelerator-samples
     15 + |    subPath: tanzu-java-web-app

--update-strategy

Specifies whether the update from file should replace or merge the current workload. The default is merge.

Note

This flag is only applicable to the tanzu apps workload apply command. It is not applicable to the tanzu apps workload create command.

Example

For example, there is a workload created from a file, which has in its spec the following:

...
spec:
  resources:
    requests:
      memory: 1Gi
    limits:           # delete this line
      memory: 1Gi     # delete this line
      cpu: 500m       # delete this line
...

If the workload file is changed as specified in the comments, there are two ways to update the workload running in the cluster.

One, with merge update strategy.

tanzu apps workload apply -f ./spring-petclinic.yaml # defaulting to merge

โ— WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).

Workload is unchanged, skipping update

The other, with replace update strategy, which completely overwrites the workload in the cluster according to the new specifications in the file.

tanzu apps workload apply -f ./spring-petclinic.yaml --update-strategy replace

โ— WARNING: Configuration file update strategy is changing. By default, provided configuration files will replace rather than merge existing configuration. The change will take place in the January 2024 TAP release (use "--update-strategy" to control strategy explicitly).

๐Ÿ”Ž Update workload:
...
  8,  8   |  name: spring-petclinic
  9,  9   |  namespace: default
 10, 10   |spec:
 11, 11   |  resources:
 12     - |    limits:
 13     - |      cpu: 500m
 14     - |      memory: 1Gi
 15, 12   |    requests:
 16, 13   |      memory: 1Gi
 17, 14   |  source:
 18, 15   |    git:
...
โ“ Really update the workload "spring-petclinic"? [yN]:

--wait

Holds the command until the workload is ready.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }} --type web --wait
๐Ÿ”Ž Update workload:
...
10, 10   |  source:
11, 11   |    git:
12, 12   |      ref:
13, 13   |        branch: main
    14 + |        tag: tap-{{ vars.tap_version }}
14, 15   |      url: https://github.com/vmware-tanzu/application-accelerator-samples
15, 16   |    subPath: tanzu-java-web-app
โ“ Really update the workload "tanzu-java-web-app"? Yes
๐Ÿ‘ Updated workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"

Waiting for workload "tanzu-java-web-app" to become ready...
Workload "tanzu-java-web-app" is ready

--wait-timeout

Sets a timeout to wait for the workload to become ready.

Example

tanzu apps workload apply tanzu-java-web-app --git-repo https://github.com/vmware-tanzu/application-accelerator-samples --sub-path tanzu-java-web-app --git-tag tap-{{ vars.tap_version }}-take1 --type web --wait --wait-timeout 1m
๐Ÿ”Ž Update workload:
...
10, 10   |  source:
11, 11   |    git:
12, 12   |      ref:
13, 13   |        branch: main
14     - |        tag: tap-{{ vars.tap_version }}
    14 + |        tag: tap-{{ vars.tap_version }}-take1
15, 15   |      url: https://github.com/vmware-tanzu/application-accelerator-samples
16, 16   |    subPath: tanzu-java-web-app
โ“ Really update the workload "tanzu-java-web-app"? Yes
๐Ÿ‘ Updated workload "tanzu-java-web-app"

To see logs:   "tanzu apps workload tail tanzu-java-web-app --timestamp --since 1h"
To get status: "tanzu apps workload get tanzu-java-web-app"

Waiting for workload "tanzu-java-web-app" to become ready...
Workload "tanzu-java-web-app" is ready

--yes, -y

Assumes --yes on all the survey prompts.

Example

tanzu apps workload apply spring-pet-clinic --local-path/home/user/workspace/spring-pet-clinic --source-image gcr.io/spring-community/spring-pet-clinic --type web -y
The files and/or directories listed in the .tanzuignore file are being excluded from the uploaded source code.
Publishing source in "/Users/dalfonso/Documents/src/java/tanzu-java-web-app" to "gcr.io/spring-community/spring-pet-clinic"...
๐Ÿ“ฅ Published source

๐Ÿ”Ž Create workload:
      1 + |---
      2 + |apiVersion: carto.run/v1alpha1
      3 + |kind: Workload
      4 + |metadata:
      5 + |  labels:
      6 + |    apps.tanzu.vmware.com/workload-type: web
      7 + |  name: spring-pet-clinic
      8 + |  namespace: default
      9 + |spec:
     10 + |  source:
     11 + |    image: gcr.io/spring-community/spring-pet-clinic:latest@sha256:5feb0d9daf3f639755d8683ca7b647027cfddc7012e80c61dcdac27f0d7856a7
๐Ÿ‘ Created workload "spring-pet-clinic"

To see logs:   "tanzu apps workload tail spring-pet-clinic --timestamp --since 1h"
To get status: "tanzu apps workload get spring-pet-clinic"

tanzu apps workload delete

Deletes workloads in a cluster. Deleting a workload does not mean the images published in the registry are deleted with it.

Usage

tanzu kubernetes apps workload delete <name(s)> [flags]

Examples

A message is displayed in the terminal asking if a workload should be deleted unless the --yes flag is used. If you indicate โ€œYโ€, then the workload starts a deletion process inside the cluster.

tanzu apps workload delete spring-pet-clinic
โ“ Really delete the workload "spring-pet-clinic"? Yes
๐Ÿ‘ Deleted workload "spring-pet-clinic"
tanzu apps workload delete spring-pet-clinic --yes
๐Ÿ‘ Deleted workload "spring-pet-clinic"

Flags

--all

Deletes all workloads in a namespace.

tanzu apps workload delete --all
โ“ Really delete all workloads in the namespace "default"? (y/N) Y
๐Ÿ‘ Deleted workloads in namespace "default"
tanzu apps workload delete --all -n my-namespace
โ“ Really delete all workloads in the namespace "my-namespace"? Yes
๐Ÿ‘ Deleted workloads in namespace "my-namespace"

--file, -f

Path to a file that contains the specification of the workload to be deleted.

tanzu apps workload delete -f path/to/file/spring-petclinic.yaml
โ“ Really delete the workload "spring-petclinic"? Yes
๐Ÿ‘ Deleted workload "spring-petclinic"

--namespace, -n

Specifies the namespace in which the workload is to be deleted.

tanzu apps workload delete spring-petclinic -n spring-petclinic-ns
โ“ Really delete the workload "spring-petclinic"? Yes
๐Ÿ‘ Deleted workload "spring-petclinic"

--wait

Waits until workload is deleted.

tanzu apps workload delete -f path/to/file/spring-petclinic.yaml --wait
โ“ Really delete the workload "spring-petclinic"? Yes
๐Ÿ‘ Deleted workload "spring-petclinic"
Waiting for workload "spring-petclinic" to be deleted...
Workload "spring-petclinic" was deleted

--wait-timeout

Sets a timeout to wait for workload to be deleted.

tanzu apps workload delete -f path/to/file/spring-petclinic.yaml --wait --wait-timeout 1m
โ“ Really delete the workload "spring-petclinic"? Yes
๐Ÿ‘ Deleted workload "spring-petclinic"
Waiting for workload "spring-petclinic" to be deleted...
Workload "spring-petclinic" was deleted
tanzu apps workload delete spring-petclinic -n spring-petclinic-ns --wait --wait-timeout 1m
โ“ Really delete the workload "spring-petclinic"? Yes
๐Ÿ‘ Deleted workload "spring-petclinic"
Waiting for workload "spring-petclinic" to be deleted...
Error: timeout after 1m waiting for "spring-petclinic" to be deleted
To view status run: tanzu apps workload get spring-petclinic --namespace spring-petclinic-ns
Error: exit status 1

โœ–  exit status 1

--yes, -f

Assume yes on all the survey prompts.

tanzu apps workload delete spring-petclinic --yes
๐Ÿ‘ Deleted workload "spring-petclinic"

tanzu apps workload get

Retrieve information and status about a workload.

Some of the workload details in the command output are as follows:

  • Workload name, type, and namespace.
  • The source code used to build the workload or the pre-built OCI image.
  • The supply chain that processed the workload.
  • The specific resources within the supply chain that interacted with the workload, and the stamped out resources associated with each of those interactions.
  • The delivery workflow that the application follows.
  • Any issues associated with deploying the workload.
  • The pods the workload generates.
  • And when applicable, the Knative services related to the workload.

Usage

tanzu kubernetes apps workload get <name> [flags]

Examples

There are multiple sections in the workload get command output. The following data is displayed:

  • Name of the workload and its status.
  • Displays source information of workload.
  • If the workload was matched with a supply chain, the information of its name and the status is displayed.
  • Information and status of the individual steps that is defined in the supply chain for the workload.
  • Any issue with the workload: the name and corresponding message.
  • Workload related resource information and status like services claims, related pods, knative services.

At the very end of the command output, a hint to follow up commands is also displayed.

Note

The Supply Chain and Delivery sections are included in the command output depending on whether those resources are present on the target cluster. For example, if the target includes only build components, there would be no Delivery resources available and therefore the Delivery section would not be included in the command output.

tanzu apps workload get rmq-sample-app
๐Ÿ“ก Overview
   name:        rmq-sample-app
   type:        web
   namespace:   default

๐Ÿ’พ Source
   type:     git
   url:      https://github.com/jhvhs/rabbitmq-sample
   branch:   main

๐Ÿ“ฆ Supply Chain
   name:   source-to-url

   NAME               READY   HEALTHY   UPDATED   RESOURCE
   source-provider    True    True      7d11h     gitrepositories.source.toolkit.fluxcd.io/rmq-sample-app
   image-provider     True    True      2d18h     images.kpack.io/rmq-sample-app
   config-provider    True    True      7d11h     podintents.conventions.carto.run/rmq-sample-app
   app-config         True    True      7d11h     configmaps/rmq-sample-app
   service-bindings   True    True      7d11h     configmaps/rmq-sample-app-with-claims
   api-descriptors    True    True      7d11h     configmaps/rmq-sample-app-with-api-descriptors
   config-writer      True    True      2d18h     runnables.carto.run/rmq-sample-app-config-writer

๐Ÿšš Delivery
   name:   delivery-basic

   NAME              READY     HEALTHY   UPDATED   RESOURCE
   source-provider   True      True      7d11h     imagerepositories.source.apps.tanzu.vmware.com/rmq-sample-app-delivery
   deployer          True      True      6m25s     apps.kappctrl.k14s.io/rmq-sample-app

๐Ÿ’ฌ Messages
   No messages found.

๐Ÿ” Services
   CLAIM   NAME                         KIND              API VERSION
   rmq     example-rabbitmq-cluster-1   RabbitmqCluster   rabbitmq.com/v1beta1

๐Ÿ›ถ Pods
   NAME                                     READY   STATUS      RESTARTS   AGE
   rmq-sample-app-build-1-build-pod         0/1     Completed   0          56d
   rmq-sample-app-build-2-build-pod         0/1     Completed   0          46d
   rmq-sample-app-build-3-build-pod         0/1     Completed   0          45d
   rmq-sample-app-config-writer-54mwk-pod   0/1     Completed   0          6d12h
   rmq-sample-app-config-writer-74qvp-pod   0/1     Completed   0          6d16h
   rmq-sample-app-config-writer-78r5w-pod   0/1     Completed   0          45d
   rmq-sample-app-config-writer-9xs5f-pod   0/1     Completed   0          46d

๐Ÿšข Knative Services
   NAME             READY   URL
   rmq-sample-app   Ready   http://rmq-sample-app.default.127.0.0.1.nip.io

To see logs: "tanzu apps workload tail rmq-sample-app --timestamp --since 1h"

Flags

--export

Exports the submitted workload in yaml format. This flag can also be used with the --output flag. The output is shortened because some text boxes are removed.

tanzu apps workload get tanzu-java-web-app --export

---
apiVersion: carto.run/v1alpha1
kind: Workload
metadata:
labels:
    apps.tanzu.vmware.com/workload-type: web
    autoscaling.knative.dev/min-scale: "1"
name: tanzu-java-web-app
namespace: default
spec:
source:
    git:
    ref:
        tag: tap-1.3
      url: https://github.com/vmware-tanzu/application-accelerator-samples
    subPath: tanzu-java-web-app

--output/-o

Configures how the workload is shown. This supports the values yaml, yml, and json, where yaml and yml are equal. It shows the actual workload in the cluster.

  • yaml/yml

    tanzu apps workload get tanzu-java-web-app -o yaml
    ---
    apiVersion: carto.run/v1alpha1
    kind: Workload
    metadata:
    creationTimestamp: "2022-06-03T18:10:59Z"
    generation: 1
    labels:
        apps.tanzu.vmware.com/workload-type: web
        autoscaling.knative.dev/min-scale: "1"
    ...
    spec:
    source:
        git:
            ref:
                tag: tap-1.1
            url: https://github.com/vmware-tanzu/application-accelerator-samples
        subPath: tanzu-java-web-app
    status:
        conditions:
        - lastTransitionTime: "2022-06-03T18:10:59Z"
            message: ""
            reason: Ready
            status: "True"
            type: SupplyChainReady
        - lastTransitionTime: "2022-06-03T18:14:18Z"
            message: ""
            reason: ResourceSubmissionComplete
            status: "True"
            type: ResourcesSubmitted
        - lastTransitionTime: "2022-06-03T18:14:18Z"
            message: ""
            reason: Ready
            status: "True"
            type: Ready
        observedGeneration: 1
        resources:
        ...
        supplyChainRef:
            kind: ClusterSupplyChain
            name: source-to-url
            ...
    
  • json

    tanzu apps workload get tanzu-java-web-app -o json
    {
        "kind": "Workload",
        "apiVersion": "carto.run/v1alpha1",
        "metadata": {
            "name": "tanzu-java-web-app",
            "namespace": "default",
            "uid": "937679ca-9c72-4e23-bfef-6334e6c003a7",
            "resourceVersion": "111637840",
            "generation": 1,
            "creationTimestamp": "2022-06-03T18:10:59Z",
            "labels": {
                "apps.tanzu.vmware.com/workload-type": "web",
                "autoscaling.knative.dev/min-scale": "1"
            },
    ...
    }
    "spec": {
            "source": {
                "git": {
                    "url": "https://github.com/vmware-tanzu/application-accelerator-samples",
                    "ref": {
                        "tag": "tap-1.3"
                    }
                },
                "subPath": "tanzu-java-web-app"
            }
        },
        "status": {
            "observedGeneration": 1,
            "conditions": [
                {
                    "type": "SupplyChainReady",
                    "status": "True",
                    "lastTransitionTime": "2022-06-03T18:10:59Z",
                    "reason": "Ready",
                    "message": ""
                },
                {
                    "type": "ResourcesSubmitted",
                    "status": "True",
                    "lastTransitionTime": "2022-06-03T18:14:18Z",
                    "reason": "ResourceSubmissionComplete",
                    "message": ""
                },
                {
                    "type": "Ready",
                    "status": "True",
                    "lastTransitionTime": "2022-06-03T18:14:18Z",
                    "reason": "Ready",
                    "message": ""
                }
            ],
            "supplyChainRef": {
                "kind": "ClusterSupplyChain",
                "name": "source-to-url"
            },
            "resources": [
                {
                    "name": "source-provider",
                    "stampedRef": {
                        "kind": "GitRepository",
                        "namespace": "default",
                        "name": "tanzu-java-web-app",
                        ...
                    }
                }
            ]
            ...
        }
        ...
    }
    

--namespace/-n

Specifies the namespace where the workload is deployed.

tanzu apps workload get tanzu-java-web-app -n development

๐Ÿ“ก Overview
   name:        tanzu-java-web-app
   type:        web
   namespace:   development

๐Ÿ’พ Source
   type:     git
   url:      https://github.com/vmware-tanzu/application-accelerator-samples
   sub-path: tanzu-java-web-app
   tag:      tap-1.3

๐Ÿ“ฆ Supply Chain
   name:   source-to-url

   NAME               READY   HEALTHY   UPDATED   RESOURCE
   source-provider    True    True      31m       gitrepositories.source.toolkit.fluxcd.io/tanzu-java-web-app
   image-provider     True    True      30m       images.kpack.io/tanzu-java-web-app
   config-provider    True    True      30m       podintents.conventions.carto.run/tanzu-java-web-app
   app-config         True    True      30m       configmaps/tanzu-java-web-app
   service-bindings   True    True      30m       configmaps/tanzu-java-web-app-with-claims
   api-descriptors    True    True      30m       configmaps/tanzu-java-web-app-with-api-descriptors
   config-writer      True    True      30m       runnables.carto.run/tanzu-java-web-app-config-writer

๐Ÿšš Delivery
   name:   delivery-basic

   NAME              READY   HEALTHY   UPDATED   RESOURCE
   source-provider   True    True      30m       imagerepositories.source.apps.tanzu.vmware.com/tanzu-java-web-app-delivery
   deployer          True    True      30m       apps.kappctrl.k14s.io/tanzu-java-web-app

๐Ÿ’ฌ Messages
   No messages found.

๐Ÿ›ถ Pods
   NAME                                        READY   STATUS      RESTARTS   AGE
   tanzu-java-web-app-build-11-build-pod       0/1     Completed   0          6d12h
   tanzu-java-web-app-build-12-build-pod       0/1     Completed   0          22h
   tanzu-java-web-app-build-3-build-pod        0/1     Completed   0          60d
   tanzu-java-web-app-config-writer-655rb-pod  0/1     Completed   0          21d
   tanzu-java-web-app-config-writer-7h8bn-pod  0/1     Completed   0          6d12h
   tanzu-java-web-app-config-writer-7xr6m-pod  0/1     Completed   0          60d
   tanzu-java-web-app-config-writer-g9gp8-pod  0/1     Completed   0          45d

๐Ÿšข Knative Services
   NAME                READY   URL
   tanzu-java-web-app  Ready   http://tanzu-java-web-app.default.127.0.0.1.nip.io

To see logs: "tanzu apps workload tail tanzu-java-web-app --namespace development --timestamp --since 1h"

tanzu apps workload list

Gets the workloads present in the cluster, either in the current namespace, in another namespace, or all namespaces.

Usage

tanzu kubernetes apps workload list [flags]

Examples

The default view for tanzu apps workload list is a table with the workloads present in the cluster in the specified namespace. Each row displays the name of the workload, the application it is related to, its status, and how long itโ€™s been in the cluster.

For example, in the default namespace

tanzu apps workload list

NAME                  TYPE      APP                  READY                   AGE
nginx4                web       <empty>              Ready                   7d9h
petclinic2            web       <empty>              Ready                   29h
rmq-sample-app        web       <empty>              Ready                   164m
rmq-sample-app4       web       <empty>              WorkloadLabelsMissing   29d
spring-pet-clinic     web       <empty>              Unknown                 166m
spring-petclinic2     web       spring-petclinic     Unknown                 29d
spring-petclinic3     <empty>   spring-petclinic     Ready                   29d
tanzu-java-web-app    web       tanzu-java-web-app   Ready                   40m
tanzu-java-web-app2   web       tanzu-java-web-app   Ready                   20m

Flags

--all-namespaces, -A

Shows workloads in all namespaces in cluster.

tanzu apps workload list -A

NAMESPACE   TYPE   NAME                  APP                  READY                         AGE
default     web    nginx4                <empty>              Ready                         7d9h
default     web    petclinic2            <empty>              Ready                         30h
default     web    rmq-sample-app        <empty>              Ready                         179m
default     web    rmq-sample-app4       <empty>              WorkloadLabelsMissing         29d
default     web    spring-pet-clinic     <empty>              Unknown                       3h1m
default     web    spring-petclinic2     spring-petclinic     Unknown                       29d
default     web    spring-petclinic3     spring-petclinic     Ready                         29d
default     web    tanzu-java-web-app    tanzu-java-web-app   Ready                         40m
default     web    tanzu-java-web-app2   tanzu-java-web-app   Ready                         20m
nginx-ns    web    nginx2                <empty>              TemplateRejectedByAPIServer   8d
nginx-ns    web    nginx4                <empty>              TemplateRejectedByAPIServer   8d

--app

Shows workloads which application is the one specified in the command.

tanzu apps workload list --app spring-petclinic

NAME                TYPE   READY     AGE
spring-petclinic2   web    Unknown   29d
spring-petclinic3   web    Ready     29d

--namespace, -n

Lists all the workloads present in the specified namespace.

tanzu apps workload list -n my-namespace

NAME   TYPE   APP       READY                         AGE
app1   web    <empty>   TemplateRejectedByAPIServer   8d
app2   web    <empty>   Ready                         8d
app3   web    <empty>   Unknown                       8d

--output, -o

Lists all workloads in the specified namespace in yaml, yml or json format.

  • yaml/yml

    ---
    - apiVersion: carto.run/v1alpha1
    kind: Workload
    metadata:
        creationTimestamp: "2022-05-17T22:06:49Z"
        generation: 1
        labels:
        app.kubernetes.io/part-of: tanzu-java-web-app
        apps.tanzu.vmware.com/workload-type: web
        managedFields:
        ...
        ...
        manager: cartographer
        operation: Update
        time: "2022-05-17T22:06:52Z"
    name: tanzu-java-web-app2
    namespace: default
    resourceVersion: "6071972"
    uid: 7fbcd40d-4eb3-41dc-a1db-657b64148708
    spec:
        source:
            git:
                ref:
                  tag: tap-1.3
                url: https://github.com/vmware-tanzu/application-accelerator-samples
            subPath: tanzu-java-web-app
    ...
    ...
    ---
    - apiVersion: carto.run/v1alpha1
    kind: Workload
    metadata:
        creationTimestamp: "2022-05-17T22:06:49Z"
        generation: 1
        labels:
        app.kubernetes.io/part-of: tanzu-java-web-app
        apps.tanzu.vmware.com/workload-type: web
        managedFields:
        ...
        ...
        manager: cartographer
        operation: Update
        time: "2022-05-17T22:06:52Z"
    name: tanzu-java-web-app
    namespace: default
    resourceVersion: "6071972"
    uid: 7fbcd40d-4eb3-41dc-a1db-657b64148708
    spec:
        source:
            git:
                ref:
                  tag: tap-1.3
                url: https://github.com/vmware-tanzu/application-accelerator-samples
            subPath: tanzu-java-web-app
    ...
    ...
    
  • json

    [
        {
            "kind": "Workload",
            "apiVersion": "carto.run/v1alpha1",
            "metadata": {
                "name": "tanzu-java-web-app2",
                "namespace": "default",
                "uid": "7fbcd40d-4eb3-41dc-a1db-657b64148708",
                "resourceVersion": "6071972",
                "generation": 1,
                "creationTimestamp": "2022-05-17T22:06:49Z",
                "labels": {
                    "app.kubernetes.io/part-of": "tanzu-java-web-app",
                    "apps.tanzu.vmware.com/workload-type": "web"
                },
            ...
            }
        ...
        },
        {
            "kind": "Workload",
            "apiVersion": "carto.run/v1alpha1",
            "metadata": {
                "name": "tanzu-java-web-app",
                "namespace": "default",
                "uid": "7fbcd40d-4eb3-41dc-a1db-657b64148708",
                "resourceVersion": "6071972",
                "generation": 1,
                "creationTimestamp": "2022-05-17T22:06:49Z",
                "labels": {
                    "app.kubernetes.io/part-of": "tanzu-java-web-app",
                    "apps.tanzu.vmware.com/workload-type": "web"
                },
            ...
            }
        ...
        },
    ...
    ...
    ]
    

tanzu apps workload tail

Checks the runtime logs of a workload.

Usage

tanzu kubernetes apps workload tail <name> [flags]

Examples

Without timestamp set, tanzu apps workload tail shows the stage where it is and the related log.

+ spring-pet-clinic-build-1-build-pod โ€บ prepare
+ spring-pet-clinic-build-1-build-pod โ€บ detect
+ spring-pet-clinic-build-1-build-pod โ€บ analyze
+ spring-pet-clinic-build-1-build-pod โ€บ build
+ spring-pet-clinic-build-1-build-pod โ€บ restore
spring-pet-clinic-build-1-build-pod[detect] ======== Output: tanzu-buildpacks/[email protected] ========
spring-pet-clinic-build-1-build-pod[detect] pyproject.toml must include [tool.poetry.dependencies.python], see https://python-poetry.org/docs/pyproject/#dependencies-and-dev-dependencies
spring-pet-clinic-build-1-build-pod[analyze] Restoring data for sbom from previous image
spring-pet-clinic-build-1-build-pod[detect] err:  tanzu-buildpacks/[email protected] (1)
spring-pet-clinic-build-1-build-pod[detect] ======== Output: tanzu-buildpacks/[email protected] ========
spring-pet-clinic-build-1-build-pod[detect] pyproject.toml must include [tool.poetry.dependencies.python], see https://python-poetry.org/docs/pyproject/#dependencies-and-dev-dependencies
spring-pet-clinic-build-1-build-pod[detect] err:  tanzu-buildpacks/[email protected] (1)
spring-pet-clinic-build-1-build-pod[detect] 10 of 38 buildpacks participating
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/ca-certificates   3.1.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/bellsoft-liberica 9.2.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/syft              1.10.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/gradle            6.4.1
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/maven             6.4.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/executable-jar    6.1.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/apache-tomcat     7.2.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/dist-zip          5.2.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/spring-boot       5.8.0
spring-pet-clinic-build-1-build-pod[detect] paketo-buildpacks/image-labels      4.1.0
...
...
...

Flags

--component

Set the component from which the tail command should stream the logs. The values that the flag can take depend on the final deployed pods label app.kubernetes.io/component, for example, build, run and, config-writer

tanzu apps workload tail pet-clinic --component build

pet-clinic-build-1-build-pod[export] Adding label 'io.buildpacks.project.metadata'
pet-clinic-build-1-build-pod[export] Adding label 'org.opencontainers.image.title'
pet-clinic-build-1-build-pod[export] Adding label 'org.opencontainers.image.version'
pet-clinic-build-1-build-pod[export] Adding label 'org.springframework.boot.version'
pet-clinic-build-1-build-pod[export] Adding label 'org.opencontainers.image.source'
pet-clinic-build-1-build-pod[export] Setting default process type 'web'
pet-clinic-build-1-build-pod[export] Saving gcr.io/dalfonso-tanzu-dev-frmwrk/pet-clinic-default...
pet-clinic-build-1-build-pod[export] *** Images (sha256:2ae6154c4433d870a330a0c2fc825340c3ead2603e3d1526e47c47cb6297fffe):
pet-clinic-build-1-build-pod[export]       gcr.io/dalfonso-tanzu-dev-frmwrk/pet-clinic-default
pet-clinic-build-1-build-pod[export]       gcr.io/dalfonso-tanzu-dev-frmwrk/pet-clinic-default:b1.20220603.181107
pet-clinic-build-1-build-pod[export] Adding cache layer 'paketo-buildpacks/bellsoft-liberica:jdk'
pet-clinic-build-1-build-pod[export] Adding cache layer 'paketo-buildpacks/syft:syft'
pet-clinic-build-1-build-pod[export] Adding cache layer 'paketo-buildpacks/maven:application'
pet-clinic-build-1-build-pod[export] Adding cache layer 'paketo-buildpacks/maven:cache'
pet-clinic-build-1-build-pod[export] Adding cache layer 'cache.sbom'

--namespace, -n

Specifies the namespace where the workload was deployed to get logs from.

tanzu apps workload tail pet-clinic -n development

pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:52.684  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.63]
+ pet-clinic-build-3-build-pod โ€บ export
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:52.699  INFO 1 --- [           main] o.a.c.c.C.[Tomcat-1].[localhost].[/]     : Initializing Spring embedded WebApplicationContext
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:52.699  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 131 ms
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:52.755  INFO 1 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 13 endpoint(s) beneath base path '/actuator'
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:53.059  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:53.074  INFO 1 --- [           main] o.s.s.petclinic.PetClinicApplication     : Started PetClinicApplication in 8.373 seconds (JVM running for 8.993)
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:53.229  INFO 1 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat-1].[localhost].[/]     : Initializing Spring DispatcherServlet 'dispatcherServlet'
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:53.229  INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
pet-clinic-00004-deployment-6445565f7b-ts8l5[workload] 2022-06-14 16:28:53.231  INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 2 ms

--since

Sets the time duration to start reading logs from.

Set the unit value in seconds s, minutes m or hours h in the format 0h0m0s. You do not need to indicate a 0 duration for a unit that is not being set. For example, 1 hour, 0 minutes and 1 seconds should be expressed as 1h1s.

The default value is 1 second 1s

tanzu apps workload tail pet-clinic --since 1h1s

pet-clinic-config-writer-9fbk6-pod[place-tools] 2022/06/14 16:28:04 Copied /ko-app/entrypoint to /tekton/bin/entrypoint
pet-clinic-config-writer-9fbk6-pod[place-scripts] 2022/06/14 16:28:06 Decoded script /tekton/scripts/script-0-dz84w
pet-clinic-config-writer-9fbk6-pod[step-init] 2022/06/14 16:28:05 Setup /step directories
pet-clinic-config-writer-9fbk6-pod[step-main] ++ mktemp -d
pet-clinic-config-writer-9fbk6-pod[step-main] + cd /tmp/tmp.n4ObHYVxpl
pet-clinic-config-writer-9fbk6-pod[step-main] + echo -e eyJkZWxpdmVyeS55bWwiOiJhcGlWZXJzaW9uOiBzZXJ2aW5nLmtuYXRpdmUuZGV2L3YxXG5raW5kOiBTZXJ2aWNlXG5tZXRhZGF0YTpcbiAgbmFtZTogcGV0LWNsaW5pY1xuICBsYWJlbHM6XG4gICAgYXBwcy50YW56dS52bXdhcmUuY29tL3dvcmtsb2FkLXR5cGU6IHdlYlxuICAgIGF1dG9zY2FsaW5nLmtuYXRpdmUuZGV2L21pbi1zY2FsZTogXCIxXCJcbiAgICBhcHAua3ViZXJuZXRlcy5pby9jb21wb25lbnQ6IHJ1blxuICAgIGNhcnRvLnJ1bi93b3JrbG9hZC1uYW1lOiBwZXQtY2xpbmljXG5zcGVjOlxuICB0ZW1wbGF0ZTpcbiAgICBtZXRhZGF0YTpcbiAgICAgIGFubm90YXRpb25zOlxuICAgICAgICBib290LnNwcmluZy5pby9hY3R1YXRvcjogaHR0cDovLzo4MDgxL2FjdHVhdG9yXG4gICAgICAgIGJvb3Quc3ByaW5nLmlvL3ZlcnNpb246IDIuNi44XG4gICAgICAgIGNvbnZlbnRpb25zLmFwcHMudGFuenUudm13YXJlLmNvbS9hcHBsaWVkLWNvbnZlbnRpb25zOiB8LVxuICAgICAgICAgIHNwcmluZy1ib290LWNvbnZlbnRpb24vc3ByaW5nLWJvb3RcbiAgICAgICAgICBzcHJpbmctYm9vdC1jb252ZW50aW9uL3NwcmluZy1ib290LWdyYWNlZnVsLXNodXRkb3duXG4gICAgICAgICAgc3ByaW5nLWJvb3QtY29udmVudGlvbi9zcHJpbmctYm9vdC13ZWJcbiAgICAgICAgICBzcHJpbmctYm9vdC1jb252ZW50aW9uL3NwcmluZy1ib290LWFjdHVhdG9yXG4gICAgICAgICAgc3ByaW5nLWJvb3QtY29udmVudGlvbi9zcHJpbmctYm9vdC1hY3R1YXRvci1wcm9iZXNcbiAgICAgICAgICBzcHJpbmctYm9vdC1jb252ZW50aW9uL3NlcnZpY2UtaW50ZW50LW15c3FsXG4gICAgICAgICAgc3ByaW5nLWJvb3QtY29udmVudGlvbi9zZXJ2aWNlLWludGVudC1wb3N0Z3Jlc1xuICAgICAgICAgIGFwcGxpdmV2aWV3LXNhbXBsZS9hcHAtbGl2ZS12aWV3LWNvbm5lY3RvclxuICAgICAgICAgIGFwcGxpdmV2aWV3LXNhbXBsZS9hcHAtbGl2ZS12aWV3LWFwcGZsYXZvdXJzXG4gICAgICAgICAgYXBwbGl2ZXZpZXctc2FtcGxlL2FwcC1saXZlLXZpZXctc3lzdGVtcHJvcGVydGllc1xuICAgICAgICBkZXZlbG9wZXIuY29udmVudGlvbnMvdGFyZ2V0LWNvbnRhaW5lcnM6IHdvcmtsb2FkXG4gICAgICAgIHNlcnZpY2VzLmNvbnZlbnRpb25zLmFwcHMudGFuenUudm13YXJlLmNvbS9teXNxbDogbXlzcWwtY29ubmVjdG9yLWphdmEvOC4wLjI5XG4gICAgICAgIHNlcnZpY2VzLmNvbnZlbnRpb25zLmFwcHMudGFuenUudm13YXJlLmNvbS9wb3N0Z3JlczogcG9zdGdyZXNxbC80Mi4zLjVcbiAgICAgIGxhYmVsczpcbiAgICAgICAgYXBwLmt1YmVybmV0ZXMuaW8vY29tcG9uZW50OiBydW5cbiAgICAgICAgYXBwcy50YW56dS52bXdhcmUuY29tL3dvcmtsb2FkLXR5cGU6IHdlYlxuICAgICAgICBjYXJ0by5ydW4vd29ya2xvYWQtbmFtZTogcGV0LWNsaW5pY1xuICAgICAgICBjb252ZW50aW9ucy5hcHBzLnRhbnp1LnZtd2FyZS5jb20vZnJhbWV3b3JrOiBzcHJpbmctYm9vdFxuICAgICAgICBzZXJ2aWNlcy5jb252ZW50aW9ucy5hcHBzLnRhbnp1LnZtd2FyZS5jb20vbXlzcWw6IHdvcmtsb2FkXG4gICAgICAgIHNlcnZpY2VzLmNvbnZlbnRpb25zLmFwcHMudGFuenUudm13YXJlLmNvbS9wb3N0Z3Jlczogd29ya2xvYWRcbiAgICAgICAgdGFuenUuYXBwLmxpdmUudmlldzogXCJ0cnVlXCJcbiAgICAgICAgdGFuenUuYXBwLmxpdmUudmlldy5hcHBsaWNhdGlvbi5hY3R1YXRvci5wb3J0OiBcIjgwODFcIlxuICAgICAgICB0YW56dS5hcHAubGl2ZS52aWV3LmFwcGxpY2F0aW9uLmZsYXZvdXJzOiBzcHJpbmctYm9vdFxuICAgICAgICB0YW56dS5hcHAubGl2ZS52aWV3LmFwcGxpY2F0aW9uLm5hbWU6IHBldGNsaW5pY1xuICAgIHNwZWM6XG4gICAgICBjb250YWluZXJzOlxuICAgICAgLSBlbnY6XG4gICAgICAgIC0gbmFtZTogSkFWQV9UT09MX09QVElPTlNcbiAgICAgICAgICB2YWx1ZTogLURtYW5hZ2VtZW50LmVuZHBvaW50LmhlYWx0aC5wcm9iZXMuYWRkLWFkZGl0aW9uYWwtcGF0aHM9XCJ0cnVlXCIgLURtYW5hZ2VtZW50LmVuZHBvaW50LmhlYWx0aC5zaG93LWRldGFpbHM9YWx3YXlzIC1EbWFuYWdlbWVudC5lbmRwb2ludHMud2ViLmJhc2UtcGF0aD1cIi9hY3R1YXRvclwiIC1EbWFuYWdlbWVudC5lbmRwb2ludHMud2ViLmV4cG9zdXJlLmluY2x1ZGU9KiAtRG1hbmFnZW1lbnQuaGVhbHRoLnByb2Jlcy5lbmFibGVkPVwidHJ1ZVwiIC1EbWFuYWdlbWVudC5zZXJ2ZXIucG9ydD1cIjgwODFcIiAtRHNlcnZlci5wb3J0PVwiODA4MFwiIC1Ec2VydmVyLnNodXRkb3duLmdyYWNlLXBlcmlvZD1cIjI0c1wiXG4gICAgICAgIGltYWdlOiBnY3IuaW8vZGFsZm9uc28tdGFuenUtZGV2LWZybXdyay9wZXQtY2xpbmljLWRlZmF1bHRAc2hhMjU2OjM5NjRiNTQwNTVlZjNkNmFiNWQ3YTM5MmVjOGU3OWJhOTg2NjczODU2NmIyOGE2OGY4ZDM2YWY5YjkyMGJhODNcbiAgICAgICAgbGl2ZW5lc3NQcm9iZTpcbiAgICAgICAgICBodHRwR2V0OlxuICAgICAgICAgICAgcGF0aDogL2xpdmV6XG4gICAgICAgICAgICBwb3J0OiA4MDgwXG4gICAgICAgICAgICBzY2hlbWU6IEhUVFBcbiAgICAgICAgbmFtZTogd29ya2xvYWRcbiAgICAgICAgcG9ydHM6XG4gICAgICAgIC0gY29udGFpbmVyUG9ydDogODA4MFxuICAgICAgICAgIHByb3RvY29sOiBUQ1BcbiAgICAgICAgcmVhZGluZXNzUHJvYmU6XG4gICAgICAgICAgaHR0cEdldDpcbiAgICAgICAgICAgIHBhdGg6IC9yZWFkeXpcbiAgICAgICAgICAgIHBvcnQ6IDgwODBcbiAgICAgICAgICAgIHNjaGVtZTogSFRUUFxuICAgICAgICByZXNvdXJjZXM6IHt9XG4gICAgICAgIHNlY3VyaXR5Q29udGV4dDpcbiAgICAgICAgICBydW5Bc1VzZXI6IDEwMDBcbiAgICAgIHNlcnZpY2VBY2NvdW50TmFtZTogZGVmYXVsdFxuIn0=
pet-clinic-config-writer-9fbk6-pod[step-main] + base64 --decode
pet-clinic-config-writer-9fbk6-pod[step-main] ++ cat files.json
+ pet-clinic-config-writer-kpmc6-pod โ€บ place-tools
pet-clinic-config-writer-9fbk6-pod[step-main] ++ jq -r 'to_entries | .[] | @sh "mkdir -p $(dirname \(.key)) && echo \(.value) > \(.key)"'
+ pet-clinic-config-writer-kpmc6-pod โ€บ step-main
+ pet-clinic-config-writer-kpmc6-pod โ€บ step-init
+ pet-clinic-config-writer-kpmc6-pod โ€บ place-scripts
pet-clinic-config-writer-9fbk6-pod[step-main] + eval 'mkdir -p $(dirname '\''delivery.yml'\'') && echo '\''apiVersion: serving.knative.dev/v1'
pet-clinic-config-writer-9fbk6-pod[step-main] kind: Service
pet-clinic-config-writer-9fbk6-pod[step-main] metadata:
pet-clinic-config-writer-9fbk6-pod[step-main]   name: pet-clinic
pet-clinic-config-writer-9fbk6-pod[step-main]   labels:
pet-clinic-config-writer-9fbk6-pod[step-main]     apps.tanzu.vmware.com/workload-type: web
pet-clinic-config-writer-9fbk6-pod[step-main]     autoscaling.knative.dev/min-scale: "1"
pet-clinic-config-writer-9fbk6-pod[step-main]     app.kubernetes.io/component: run
pet-clinic-config-writer-9fbk6-pod[step-main]     carto.run/workload-name: pet-clinic

--timestamp, -t

Adds the timestamp to the beginning of each log message

tanzu apps workload tail pet-clinic -t

pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645910625-05:00
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645942876-05:00
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645951930-05:00               |\      _,,,--,,_
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645957151-05:00              /,`.-'`'   ._  \-;;,_
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645961411-05:00   _______ __|,4-  ) )_   .;.(__`'-'__     ___ __    _ ___ _______
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645967316-05:00  |       | '---''(_/._)-'(_\_)   |   |   |   |  |  | |   |       |
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645971010-05:00  |    _  |    ___|_     _|       |   |   |   |   |_| |   |       | __ _ _
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645976591-05:00  |   |_| |   |___  |   | |       |   |   |   |       |   |       | \ \ \ \
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645986474-05:00  |    ___|    ___| |   | |      _|   |___|   |  _    |   |      _|  \ \ \ \
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645990521-05:00  |   |   |   |___  |   | |     |_|       |   | | |   |   |     |_    ) ) ) )
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645994112-05:00  |___|   |_______| |___| |_______|_______|___|_|  |__|___|_______|  / / / /
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.645998053-05:00  ==================================================================/_/_/_/
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.646001577-05:00
pet-clinic-00002-deployment-5cc69cfdc8-t45sc[workload] 2022-06-09T18:10:07.646005296-05:00 :: Built with Spring Boot :: 2.6.8
check-circle-line exclamation-circle-line close-line
Scroll to top icon