About Tekton CLI

With the Tekton (tkn) Pipelines command-line interface (CLI) you can interact with Tekton from a terminal. This section describes how to install it and lists the basic commands.

Installing the CLI

In order to interact with Tekton from a terminal, you need to install the Tekton CLI (tkn).

Tarball Installation

For macOS X

  1. Download the compressed file:

    $ curl -LO https://github.com/tektoncd/cli/releases/download/v0.8.0/tkn_0.8.0_Darwin_x86_64.tar.gz
  2. Extract the compressed file:

    $ sudo tar xvzf tkn_0.8.0_Darwin_x86_64.tar.gz -C /usr/local/bin tkn
  3. Place it in a directory that is on your PATH

For Linux AMD64

  1. Download the compressed file:

    $ curl -LO https://github.com/tektoncd/cli/releases/download/v0.8.0/tkn_0.8.0_Linux_x86_64.tar.gz
  2. Extract the compressed file:

    $ sudo tar xvzf tkn_0.8.0_Linux_x86_64.tar.gz -C /usr/local/bin/ tkn
  3. Place it in a directory that is on your PATH

For Linux ARM64

  1. Download the compressed file:

    $ curl -LO https://github.com/tektoncd/cli/releases/download/v0.8.0/tkn_0.8.0_Linux_arm64.tar.gz
  2. Extract the compressed file:

    $ sudo tar xvzf tkn_0.8.0_Linux_arm64.tar.gz -C /usr/local/bin/ tkn
  3. Place it in a directory that is on your PATH

For Windows

  1. Download the zip file:

    C:\Users\Admin\Downloads> curl -Uri https://github.com/tektoncd/cli/releases/download/v0.8.0/tkn_0.8.0_Windows_x86_64.zip
     -OutFile tkn_0.8.0_Windows_x86_64.zip
  2. Extract the compressed file tkn.exe to your PATH:

    Expand-Archive -Path <sourcepath>/tkn_0.8.0_Windows_x86_64.zip -DestinationPath <destinationpath>

Pipeline tkn reference

This section lists basic tkn CLI commands. For a more detailed description, see Tekton Pipelines CLI.

Basic Syntax

tkn [command or options] [arguments…​]

Global Options

--help, -h

Utility commands

tkn

Parent command for tkn CLI.

Example:Display all options
$ tkn

tkn completion [shell]

Print shell completion code which must be evaluated to provide interactive completion. Supported shells are bash and zsh.

Example: Completion code for bash shell
$ tkn completion bash

tkn version

Print version information of the tkn CLI.

Example: Check for the availability of a newer version
$ tkn version -c

Pipelines management commands

tkn pipeline

Manage pipelines.

Example: Display help
$ pipeline --help

tkn pipeline create

Create a pipeline in a namespace.

Example: Create a pipeline defined by the mypipeline.yaml file in a namespace
$ tkn pipeline create -f mypipeline.yaml -n myspace

tkn pipeline delete

Delete a pipeline in a namespace.

Example: Delete the mypipeline pipeline from a namespace
$ tkn pipeline delete mypipeline -n myspace

tkn pipeline describe

Describe a pipeline in a namespace.

Example: Describe mypipeline pipeline
$ tkn pipeline describe mypipeline

tkn pipeline list

List pipelines in a namespace.

Example: Display a list of pipelines
$ tkn pipeline list

tkn pipeline logs

Display pipeline logs for a specific pipeline.

Example: Stream live logs for the mypipeline pipeline
$ tkn pipeline logs -f mypipeline

tkn pipeline start

Start a pipeline.

Example: Start mypipeline pipeline
$ tkn pipeline start mypipeline

Pipelinerun commands

tkn pipelinerun

Manage pipelineruns.

Example: Display help
$ tkn pipelinerun -h

tkn pipelinerun cancel

Cancel a pipelinerun in a namespace.

Example: Cancel the mypipelinerun pipelinerun from a namespace
$ tkn pipeline cancel mypipelinerun -n myspace

tkn pipelinerun delete

Delete pipelinerun in a namespace.

Example: Delete pipelineruns from a namespace
$ tkn pipelinerun delete mypipelinerun1 mypipelinerun2 -n myspace

tkn pipelinerun describe

Describe a pipelinerun in a namespace.

Example: Describe the mypipelinerun pipelinerun in a namespace
tkn pipelinerun describe mypipelinerun -n myspace

tkn pipelinerun list

Display a list of pipelineruns in a namespace.

Example: Display a list of pipelineruns in a namespace
$ tkn pipelinerun list -n myspace

tkn pipelinerun logs

Show the logs of pipelinerun.

Example: Display the logs of the mypipelinerun pipelinerun with all tasks and steps in a namespace
$ tkn pipelinerun logs mypipeline -a -n myspace

Task management commands

tkn task

Manage tasks.

Example: Display help
$ tkn task -h

tkn task create

Create a task in a namespace.

Example: Create a task defined by the mytask.yaml file in a namespace
$ tkn task create -f mytask.yaml -n myspace

tkn task delete

Delete task resources in a namespace.

Example: Delete mytask1 and mytask2 tasks from a namespace
$ tkn task delete mytask1 mytask2 -n myspace

tkn task describe

Describe a task in a namespace.

Example: Describe the mytask task in a namespace
$ tkn task describe mytask -n myspace

tkn task list

List tasks in a namespace.

Example: List all the tasks in a namespace
$ tkn task list -n myspace

tkn task logs

Display task logs.

Example: Display logs for the mytaskrun taskrun of the mytask task
$ tkn task logs mytask mytaskrun -n myspace

tkn task start

Start a task.

Example: Start the mytask task in a namespace
$ tkn task start mytask -s <ServiceAccountName> -n myspace

Taskrun commands

tkn taskrun

Manage taskruns.

Example: Display help
$ tkn taskrun -h

tkn taskrun cancel

Cancel a taskrun in a namespace.

Example: Cancel the mytaskrun taskrun from a namespace
$ tkn taskrun cancel mytaskrun -n myspace

tkn taskrun delete

Delete taskruns in a namespace.

Example: Delete mytaskrun1 and mytaskrun2 taskruns from a namespace
$ tkn taskrun delete mytaskrun1 mytaskrun2 -n myspace

tkn taskrun describe

Describe a taskrun in a namespace.

Example: Describe the mytaskrun taskrun in a namespace
$ tkn taskrun describe mytaskrun -n myspace

tkn taskrun list

List taskruns in a namespace.

Example: List all taskruns in a namespace
$ tkn taskrun list -n myspace

tkn taskrun logs

Display taskruns logs.

Example: Display live logs for the mytaskrun taskrun in a namespace `
$ tkn taskrun logs -f mytaskrun -n myspace

Condition management commands

tkn condition

Manage conditions.

Example: Display help
$ tkn condition --help

tkn condition delete

Delete a condition in a namespace.

Example: Delete the mycondition1 condition from a namespace
$ tkn condition delete mycondition1 -n myspace

tkn condition list

List conditions in a namespace.

Example: List conditions in a namespace
$ tkn condition list -n myspace

Pipeline resource management commands

tkn resource

Manage pipeline resources.

Example: Display help
$ tkn resource -h

tkn resource create

Create a pipeline resource in a namespace.

Example: Create pipeline resource defined by the myresource.yaml file in a namespace
$ tkn resource create -f myresource.yaml -n myspace

tkn resource delete

Delete a pipeline resource in a namespace.

Example: Delete the myresource pipeline resource from a namespace
$ tkn resource delete myresource -n myspace

tkn resource describe

Describes a pipeline resource in a namespace.

Example: Describe the myresource pipeline resource
$ tkn resource describe myresource -n `myspace`

tkn resource list

List pipeline resources in a namespace.

Example: List all pipeline resources in a namespace
$ tkn resource list -n `myspace`

Clustertask management commands

tkn clustertask

Manage clustertasks.

Example: Display help
$ tkn clustertask --help

tkn clustertask delete

Delete a clustertask resource in a cluster.

Example: Delete mytask1 and mytask2 clustertasks
$ tkn clustertask delete mytask1 mytask2

tkn clustertask describe

Describe a clustertask.

Example: Describe the mytask clustertask
$ tkn clustertask describe mytask1

tkn clustertask list

List clustertasks in a namespace.

Example: List clustertasks in a namespace
$ tkn clustertask list -n myspace

tkn clustertask start

Start clustertasks.

Example: Start the mytask clustertask in a namespace
$ tkn clustertask start mytask -n myspace

Trigger management commands

tkn eventlistener

Manage event listeners.

Example: Display help
$ tkn eventlistener -h

tkn eventlistener delete

Delete event listeners in a namespace.

Example: Delete mylistener1 and mylistener2 event listeners in a namespace
$ tkn eventlistener delete mylistener1 mylistener2 -n myspace

tkn eventlistener list

Lists event listeners in a namespace.

Example: List all event listeners in a namespace
$ tkn eventlistener list -n myspace

tkn triggerbinding

Manage trigger bindings.

Example: Display trigger bindings help
$ tkn triggerbinding -h

tkn triggerbinding delete

Delete trigger bindings in a namespace.

Example: Delete mybinding1 and mybinding2 trigger bindings in a namespace
$ tkn triggerbinding delete mybinding1 mybinding2 -n myspace

tkn triggerbinding list

List trigger bindings in a namespace.

Example: List all trigger bindings in a namespace
$ tkn triggerbinding list -n myspace

tkn triggertemplate

Manage trigger templates.

Example: Display trigger template help
$ tkn triggertemplate -h

tkn triggertemplate delete

Delete trigger templates in a namespace.

Example: Delete mytemplate1 and mytemplate2 trigger templates in a namespace
$ tkn triggertemplate delete mytemplate1 mytemplate2 -n `myspace`

tkn triggertemplate list

Lists trigger templates in a namespace.

Example: List all trigger templates in a namespace
$ tkn triggertemplate list -n myspace