|
| 1 | +--- |
| 2 | +title: Tekton CLI (tkn) |
| 3 | + |
| 4 | +draft: true |
| 5 | + |
| 6 | +author: Jason Andrews |
| 7 | +official_docs: https://tekton.dev/docs/cli/ |
| 8 | + |
| 9 | +minutes_to_complete: 10 |
| 10 | +additional_search_terms: |
| 11 | +- tekton |
| 12 | +- pipelines |
| 13 | +- ci/cd |
| 14 | +- kubernetes |
| 15 | +- openshift |
| 16 | +- devops |
| 17 | + |
| 18 | +layout: installtoolsall |
| 19 | +multi_install: false |
| 20 | +multitool_install_part: false |
| 21 | +test_images: |
| 22 | +- ubuntu:latest |
| 23 | +test_maintenance: false |
| 24 | +tool_install: true |
| 25 | +weight: 1 |
| 26 | +--- |
| 27 | + |
| 28 | +The Tekton CLI, `tkn`, is a command-line interface for Tekton Pipelines. It allows you to create, manage, and interact with Tekton resources such as tasks, pipelines, and pipeline runs from your terminal. |
| 29 | + |
| 30 | +Tekton CLI is available for macOS and Linux and supports the Arm architecture. |
| 31 | + |
| 32 | +## What should I consider before installing the Tekton CLI? |
| 33 | + |
| 34 | +This article provides a quick way to install the latest version of the Tekton CLI for Ubuntu on Arm and macOS with Apple Silicon. |
| 35 | + |
| 36 | +Confirm you are using an Arm computer by running: |
| 37 | + |
| 38 | +```bash { target="ubuntu:latest" } |
| 39 | +uname -m |
| 40 | +``` |
| 41 | + |
| 42 | +If you are on Arm Linux the output should be: |
| 43 | + |
| 44 | +```output |
| 45 | +aarch64 |
| 46 | +``` |
| 47 | + |
| 48 | +If you are on macOS with Apple Silicon the output should be: |
| 49 | + |
| 50 | +```output |
| 51 | +arm64 |
| 52 | +``` |
| 53 | + |
| 54 | +## How do I download and install the Tekton CLI? |
| 55 | + |
| 56 | +There are multiple ways to install the Tekton CLI. The methods below download the latest stable version directly from the GitHub releases. |
| 57 | + |
| 58 | +### Install on Arm Linux |
| 59 | + |
| 60 | +To install the Tekton CLI on Arm Linux: |
| 61 | + |
| 62 | +```bash { target="ubuntu:latest" } |
| 63 | +TKN_VERSION=$(curl -s https://api.github.com/repos/tektoncd/cli/releases/latest | grep tag_name | cut -d '"' -f 4) |
| 64 | +curl -LO https://github.com/tektoncd/cli/releases/download/${TKN_VERSION}/tektoncd-cli-${TKN_VERSION#v}_Linux-ARM64.deb |
| 65 | +sudo apt install ./tektoncd-cli-${TKN_VERSION#v}_Linux-ARM64.deb |
| 66 | +``` |
| 67 | + |
| 68 | +### Install on macOS |
| 69 | + |
| 70 | +To install the Tekton CLI on macOS with Apple Silicon: |
| 71 | + |
| 72 | +```console |
| 73 | +TKN_VERSION=$(curl -s https://api.github.com/repos/tektoncd/cli/releases/latest | grep tag_name | cut -d '"' -f 4) |
| 74 | +curl -LO https://github.com/tektoncd/cli/releases/download/${TKN_VERSION}/tkn_${TKN_VERSION#v}_Darwin_all.tar.gz |
| 75 | +tar -xzf tkn_${TKN_VERSION#v}_Darwin_all.tar.gz |
| 76 | +sudo mv tkn /usr/local/bin/ |
| 77 | +rm tkn_${TKN_VERSION#v}_Darwin_all.tar.gz README.md LICENSE |
| 78 | +``` |
| 79 | + |
| 80 | +Alternatively, you can install using Homebrew on macOS: |
| 81 | + |
| 82 | +```console |
| 83 | +brew install tektoncd-cli |
| 84 | +``` |
| 85 | + |
| 86 | +## How do I verify the Tekton CLI installation? |
| 87 | + |
| 88 | +Verify the Tekton CLI is installed by checking the version: |
| 89 | + |
| 90 | +```bash { target="ubuntu:latest" } |
| 91 | +tkn version |
| 92 | +``` |
| 93 | + |
| 94 | +The output shows the client version information: |
| 95 | + |
| 96 | +```output |
| 97 | +Client version: 0.41.0 |
| 98 | +``` |
| 99 | + |
| 100 | +You can also check that the command is working by displaying the help: |
| 101 | + |
| 102 | +```bash { target="ubuntu:latest" } |
| 103 | +tkn help |
| 104 | +``` |
| 105 | + |
| 106 | +This displays the main command groups and options: |
| 107 | + |
| 108 | +```output |
| 109 | +CLI for tekton pipelines |
| 110 | +
|
| 111 | +Usage: |
| 112 | + tkn [flags] |
| 113 | + tkn [command] |
| 114 | +
|
| 115 | +Available Commands: |
| 116 | + bundle Manage Tekton Bundles |
| 117 | + chain Manage Chains |
| 118 | + clustertask Manage ClusterTasks |
| 119 | + clustertriggerbinding Manage ClusterTriggerBindings |
| 120 | + completion Prints shell completion scripts |
| 121 | + eventlistener Manage EventListeners |
| 122 | + help Help about any command |
| 123 | + hub Interact with tekton hub |
| 124 | + pipeline Manage pipelines |
| 125 | + pipelinerun Manage pipeline runs |
| 126 | + resource Manage pipeline resources |
| 127 | + task Manage Tasks |
| 128 | + taskrun Manage TaskRuns |
| 129 | + triggerbinding Manage TriggerBindings |
| 130 | + triggertemplate Manage TriggerTemplates |
| 131 | + version Prints version information |
| 132 | +
|
| 133 | +Flags: |
| 134 | + -h, --help help for tkn |
| 135 | +
|
| 136 | +Use "tkn [command] --help" for more information about a command. |
| 137 | +``` |
| 138 | + |
| 139 | +## How do I get started with the Tekton CLI? |
| 140 | + |
| 141 | +To use the Tekton CLI effectively, you need access to a Kubernetes cluster with Tekton Pipelines installed. You can check if Tekton is available in your cluster: |
| 142 | + |
| 143 | +```console |
| 144 | +tkn pipeline list |
| 145 | +``` |
| 146 | + |
| 147 | +If Tekton Pipelines is not installed, you might see an error message. In that case, you need to install Tekton Pipelines on your cluster first. |
| 148 | + |
| 149 | +### Common Tekton CLI commands |
| 150 | + |
| 151 | +Below are some common commands to get you started. |
| 152 | + |
| 153 | +List pipelines: |
| 154 | + |
| 155 | +```console |
| 156 | +tkn pipeline list |
| 157 | +``` |
| 158 | + |
| 159 | +List pipeline runs: |
| 160 | + |
| 161 | +```console |
| 162 | +tkn pipelinerun list |
| 163 | +``` |
| 164 | + |
| 165 | +List tasks: |
| 166 | + |
| 167 | +```console |
| 168 | +tkn task list |
| 169 | +``` |
| 170 | + |
| 171 | +List task runs: |
| 172 | + |
| 173 | +```console |
| 174 | +tkn taskrun list |
| 175 | +``` |
| 176 | + |
| 177 | +Start a pipeline: |
| 178 | + |
| 179 | +```console |
| 180 | +tkn pipeline start <pipeline-name> |
| 181 | +``` |
| 182 | + |
| 183 | +Show pipeline run logs: |
| 184 | + |
| 185 | +```console |
| 186 | +tkn pipelinerun logs <pipelinerun-name> |
| 187 | +``` |
| 188 | + |
| 189 | +Describe a pipeline: |
| 190 | + |
| 191 | +```console |
| 192 | +tkn pipeline describe <pipeline-name> |
| 193 | +``` |
| 194 | + |
| 195 | +You are now ready to use the Tekton CLI to manage your CI/CD pipelines with Tekton Pipelines on Kubernetes or OpenShift. |
0 commit comments