提交 d4203955 编写于 作者: G Geri Ochoa 提交者: tekton-robot

Crete a quickstart to run your first tekton pipeline

Introductory guide for newcomers. This is a two-file quickstart that
shows a simple example to create a task and a pipeline.

These tutorials do not include new information. The information here is
reorganized to be easier to understand for newcomers. Including
prescritpive steps that the user just has to copy/paste .
上级 fee9d4dc
......@@ -3,373 +3,13 @@ title: "Getting Started"
linkTitle: "Getting Started"
weight: 1
description: >
Prerequisites, Installation, and Basic Usage
Get started with Tekton
---
{{% tutorial name="Getting started with Tekton"
katacoda-lnk="https://katacoda.com/tektoncd/scenarios/getting-started" %}}
Welcome to Tekton. Tekton is an open-source cloud native CICD (Continuous
Integration and Continuous Delivery/Deployment) solution. Check the [Concepts
section](/docs/concepts/) to learn more about how Tekton works.
## Prerequisites
Let's get started! Go ahead and [create your first task with
Tekton](/docs/getting-started/tasks/)
* A Kubernetes cluster version 1.15 or higher for Tekton Pipelines v0.11.0 or higher, or a Kubernetes
cluster version 1.11 or higher for Tekton releases before v0.11.0.
* Enable [Role-Based Access Control (RBAC)](https://kubernetes.io/docs/reference/access-authn-authz/rbac/)
in the cluster.
* Grant current user the `cluster-admin` role.
If you don't already have a cluster, you can create one for testing with `kind`.
[Install `kind`](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) and create a cluster by running [`kind create cluster`](https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster). This
will create a cluster running locally, with RBAC enabled and your user granted
the `cluster-admin` role.
## Installation
To install the core component of Tekton, Tekton Pipelines, run the command below:
```sh
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
```
If your container runtime does not support `image-reference:tag@digest` (for example, like cri-o used in OpenShift 4.x), use `release.notags.yaml` instead:
```sh
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.notags.yaml
```
{{% alert title="Note" color="success" %}}
This command automatically installs the latest official release of the
Tekton core component, Tekton Pipelines. If
you would like to install a previous version, use
```
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/YOUR-VERSION/release.yaml
```
Replace `YOUR-VERSION` with the release you prefer. [You can find the full list
of official Tekton releases on GitHub](https://github.com/tektoncd/pipeline/releases).
Additionally, Tekton Pipelines pushes nightly releases every night to
https://storage.googleapis.com/tekton-releases-nightly/. For example, if you
would like to run a nightly release of Tekton Pipelines, you would install it by
running the command below.
```sh
kubectl apply --filename https://storage.googleapis.com/tekton-releases-nightly/pipeline/latest/release.yaml
```
If you are feeling adventurous and would like to
experiment with the most recent, unreleased code, see [Tekton Development Guide](https://github.com/tektoncd/pipeline/blob/main/DEVELOPMENT.md).
{{% /alert %}}
It may take a few moments before the installation completes. You can check
the progress with the following command:
```sh
kubectl get pods --namespace tekton-pipelines
```
Confirm that every component listed has the status `Running`.
### Persistent volumes
To run a CI/CD workflow, you need to provide Tekton a [Persistent Volume](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)
for storage purposes. Tekton requests a volume of `5Gi` with
the default storage class by default. **Your Kubernetes
cluster, such as one from Google Kubernetes Engine, may have persistent volumes
set up at the time of creation, thus no extra step is required**; if not, you
may have to create them manually. Alternatively, you may ask Tekton
to use a [Google Cloud Storage](https://cloud.google.com/storage) bucket
or an [AWS Simple Storage Service (Amazon S3)](https://aws.amazon.com/s3/)
bucket instead. Note that the performance of Tekton may vary depending on
the storage option you choose.
{{% alert title="Note" color="success" %}}
You can check available persistent volumes and storage classes with the
commands below:
```
kubectl get pv
kubectl get storageclasses
```
{{% /alert %}}
These storage options can be configured using [`ConfigMaps`](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/):
{{% tabs %}}
{{% tab "Persistent Volumes" %}}
If you would like to configure the size and storage class of the Persistent
Volume Tekton requests, update the default `config-artifact-pvc` `configMap`.
This `configMap` includes two attributes:
* `size`: the size of the volume
* `storageClassName`: the name of the storage class of the volume
The following example asks Tekton to request a Persistent Volume of `10Gi` with
the `manual` storage class when running a workflow:
```
kubectl create configmap config-artifact-pvc \
--from-literal=size=10Gi \
--from-literal=storageClassName=manual \
-o yaml -n tekton-pipelines \
--dry-run=client | kubectl replace -f -
```
{{% /tab %}}
{{% tab "Buckets" %}}
If you would like to use Google Cloud Storage or AWS S3 buckets instead,
remove the default `config-artifact-pvc` `configMap` and create another
one of the name `config-artifact-bucket`. This `configMap` includes the
following attributes:
* `location`: the address of the bucket, such as `gs://my-gcs-bucket/`
* `bucket.service.account.secret.name`: the name of the
[Kubernetes secret](https://kubernetes.io/docs/concepts/configuration/secret/)
where the service account credentials for accessing the bucket reside.
* `bucket.service.account.secret.key`: the name of the key in the secret which
Tekton should use
* `bucket.service.account.field.name`: the name of the environment variable
to use when setting up the credentials. Defaults to `GOOGLE_APPLICATION_CREDENTIALS`;
use `BOTO_CONFIG` if you plan to use an AWS S3 bucket.
The following example asks Tekton to use a Google Cloud Storage bucket for
storage when running a workflow:
```
kubectl create configmap config-artifact-pvc \
--from-literal=location=gs://MY-GCS-BUCKET \
--from-literal=bucket.service.account.secret.name=my-secret \
--from-literal=bucket.service.account.secret.key=my-key \
-o yaml -n tekton-pipelines \
--dry-run=client | kubectl replace -f -
```
And the `my-secret` Kubernetes secret is configured as follows:
```
apiVersion: v1
kind: Secret
metadata:
name: my-secret
type: kubernetes.io/opaque
stringData:
my-key: MY-SERVICE-ACCOUNT-JSON-KEY
```
{{% /tab %}}
{{% /tabs %}}
Also, Tekton uses the default service account in your Kubernetes cluster
unless otherwise configured; if you would like to override this option,
update the `default-service-account` attribute of the `ConfigMap`
`config-defaults`:
```
kubectl create configmap config-defaults \
--from-literal=default-service-account=YOUR-SERVICE-ACCOUNT \
-o yaml -n tekton-pipelines \
--dry-run=client | kubectl replace -f -
```
### Set up the CLI
For your convenience, it is recommended that you install the Tekton CLI, `tkn`,
together with the core component of Tekton, Tekton Pipelines.
{{% tabs %}}
{{% tab "macOS" %}}
`tkn` is available on macOS via [`brew`](https://brew.sh/):
```bash
brew install tektoncd-cli
```
You can also download it as a tarball from the [`tkn` Releases page](https://github.com/tektoncd/cli/releases).
After downloading the file, extract it to your `PATH`:
```bash
# Replace YOUR-DOWNLOADED-FILE with the file path of your own.
sudo tar xvzf YOUR-DOWNLOADED-FILE -C /usr/local/bin/ tkn
```
{{% /tab %}}
{{% tab "Windows" %}}
`tkn` is available on Windows via [Chocolatey](https://chocolatey.org/):
```cmd
choco install tektoncd-cli --confirm
```
You can also download it as a `.zip` file from the [`tkn` Releases page](https://github.com/tektoncd/cli/releases).
After downloading the file, add it to your `Path`:
* Uncompress the `.zip` file.
* Open **Control Panel** > **System and Security** > **System** > **Advanced System Settings**.
* Click **Environment Variables**, select the `Path` variable and click **Edit**.
* Click **New** and add the path to your uncompressed file.
* Click **OK**.
{{% /tab %}}
{{% tab "Linux" %}}
`tkn` is available on Linux as a `.deb` package (for Debian, Ubuntu and
other deb-based distros) and `.rpm` package (for Fedora, CentOS, and other
rpm-based distros).
* Debian, Ubuntu, and other deb-based distros
Find the `.deb` package of the `tkn` release you would like to install on
the [`tkn` Releases page](https://github.com/tektoncd/cli/releases) and
install it with
```bash
# Replace LINK-TO-THE-PACKAGE with the package URL you would like to use.
curl -LO LINK-TO-THE-PACKAGE
sudo dpkg -i ./PACKAGE-NAME
```
If you are using the latest releases of Ubuntu or Debian, you may use the
TektonCD CLI PPA instead:
```bash
sudo apt update;sudo apt install -y gnupg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3EFE0E0A2F2F60AA
echo "deb http://ppa.launchpad.net/tektoncd/cli/ubuntu eoan main"|sudo tee /etc/apt/sources.list.d/tektoncd-ubuntu-cli.list
sudo apt update && sudo apt install -y tektoncd-cli
```
* Fedora, CentOS, and other rpm-based distros
Find the `.rpm` package of the `tkn` release you would like to install on
the [`tkn` Releases page](https://github.com/tektoncd/cli/releases) and
install it with
```bash
# Replace LINK-TO-THE-PACKAGE with the package URL you would like to use.
rpm -Uvh LINK-TO-THE-PACKAGE
```
If you are using Fedora 33/34, CentOS 7/8, EPEL, or RHEL 8, @chmousel
provides an unofficial `copr` package repository for installing the
package:
```bash
dnf copr enable chmouel/tektoncd-cli
dnf install tektoncd-cli
```
Alternatively, you may download `tkn` as a tarball:
Find the tarball of the `tkn` release for your platform (`ARM` or `X86-64`)
you would like to install on the [`tkn` Releases page](https://github.com/tektoncd/cli/releases)
and install it with
```bash
# Replace LINK-TO-TARBALL with the package URL you would like to use.
curl -LO LINK-TO-TARBALL
# Replace YOUR-DOWNLOADED-FILE with the file path of your own.
sudo tar xvzf YOUR-DOWNLOADED-FILE -C /usr/local/bin/ tkn
```
{{% /tab %}}
{{% /tabs %}}
## Your first CI/CD workflow with Tekton
With Tekton, each operation in your CI/CD workflow becomes a `Step`,
which is executed with a container image you specify. `Steps` are then
organized in `Tasks`, which run as a [Kubernetes pod](https://kubernetes.io/docs/concepts/workloads/pods/)
in your cluster. You can further organize `Tasks` into `Pipelines`, which
can control the order of execution of several `Tasks`.
To create a `Task`, create a Kubernetes object using the Tekton API with
the kind `Task`. The following YAML file specifies a `Task` with one simple
`Step`, which prints a `Hello World!` message using
[the official Ubuntu image](https://hub.docker.com/_/ubuntu/):
```yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: hello
image: ubuntu
command:
- echo
args:
- "Hello World!"
```
Write the YAML above to a file named `task-hello.yaml`, and apply it to your Kubernetes cluster:
```bash
kubectl apply -f task-hello.yaml
```
To run this task with Tekton, you need to create a `TaskRun`, which is
another Kubernetes object used to specify run time information for a `Task`.
To view this `TaskRun` object you can run the following Tekton CLI (`tkn`) command:
```shell
tkn task start hello --dry-run
```
After running the command above, the following `TaskRun` definition should be shown:
```yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: hello-run-
spec:
taskRef:
name: hello
```
To use the `TaskRun` above to start the `echo` `Task`, you can either use
`tkn` or `kubectl`.
Start with `tkn`:
```shell
tkn task start hello
```
Start with `kubectl`:
```shell
# use tkn's --dry-run option to save the TaskRun to a file
tkn task start hello --dry-run > taskRun-hello.yaml
# create the TaskRun
kubectl create -f taskRun-hello.yaml
```
Tekton will now start running your `Task`. To see the logs of the last `TaskRun`, run
the following `tkn` command:
```shell
tkn taskrun logs --last -f
```
It may take a few moments before your `Task` completes. When it executes, it should
show the following output:
```
[hello] Hello World!
```
## What's next
Now you have the core component of Tekton, Tekton Pipelines, installed on
your cluster with the Tekton CLI installed on your local
machine. Continue to experiment with pipelines with the
[Getting Started - Pipelines](./pipelines). If you would like to install
more components, see the list below:
* [Tekton Triggers](/docs/triggers)
* [Tekton Dashboard](/docs/dashboard)
Learn more about Tekton in [Concepts](/docs/concepts/).
---
title: "Getting Started with Pipelines"
linkTitle: "Getting Started with Pipelines"
weight: 1
weight: 2
description: >
Prerequisites, Installation, and Basic Usage
Create and run your first Tekton pipeline
---
## Prerequisites
This tutorial shows you how to:
* Completed the [Getting Started example](/docs/getting-started/).
## Extending your first CI/CD Workflow with a second Task and a Pipeline
As you learned previously, with Tekton, each operation in your CI/CD workflow becomes a `Step`,
which is executed with a container image you specify. `Steps` are then
organized in `Tasks`, which run as a [Kubernetes pod](https://kubernetes.io/docs/concepts/workloads/pods/)
in your cluster. You can further organize `Tasks` into `Pipelines`, which
can control the order of execution of several `Tasks`.
To create a second `Task`, create a Kubernetes object using the Tekton API with
the kind `Task`. The following YAML file specifies a `Task` with one simple
`Step`, which prints a `Goodbye World!` message using
[the official Ubuntu image](https://hub.docker.com/_/ubuntu/):
```yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: goodbye
spec:
steps:
- name: goodbye
image: ubuntu
script: |
#!/bin/bash
echo "Goodbye World!"
```
- Create two tasks.
- Create a pipeline containing your tasks.
- Use `PipelineRun` to instantiate and run the pipeline containing your tasks.
Write the YAML above to a file named `task-goodbye.yaml`, and apply it to your Kubernetes cluster:
For this tutorial we are going to use [minikube][minikube] to run the commands
locally.
```bash
kubectl apply -f task-goodbye.yaml
```
## Prerequisites
To run this task with Tekton, you need to create a `TaskRun`, which is
another Kubernetes object used to specify run time information for a `Task`.
- Complete the [Getting started with tasks](/docs/getting-started/tasks/)
tutorial. *Do not clean up your resources*, skip the last section.
To view this `TaskRun` object you can run the following Tekton CLI (`tkn`) command:
- [Install the Tekton CLI](/docs/cli/).
```shell
tkn task start goodbye --dry-run
```
## Creating and running a second task
After running the command above, the following `TaskRun` definition should be shown:
You already have a *Hello World!* task. To create a second *Goodbye World!*
task:
```yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
generateName: goodbye-run-
spec:
taskRef:
name: goodbye
```
1. Create a new file named `goodbye-world.yaml` and add the following
content:
To use the `TaskRun` above to start the `echo` `Task`, you can either use
`tkn` or `kubectl`.
```yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: goodbye
spec:
steps:
- name: goodbye
image: ubuntu
script: |
#!/bin/bash
echo "Goodbye World!"
```
Start with `tkn`:
1. Apply your task file:
```shell
tkn task start goodbye
```
```bash
kubectl apply --filename goodbye-world.yaml
```
Start with `kubectl`:
When a task is part of a pipeline you don't have to instantiate it, the pipeline
is going to take care of that.
```shell
# use tkn's --dry-run option to save the TaskRun to a file
tkn task start goodbye --dry-run > taskRun-goodbye.yaml
# create the TaskRun
kubectl create -f taskRun-goodbye.yaml
```
## Creating and running a pipeline
Tekton will now start running your `Task`. To see the logs of the `TaskRun`, run
the following `tkn` command:
A **[pipeline](/docs/pipelines/pipelines/)** defines an ordered series of tasks
arranged in a specific execution order as part of your CI/CD workflow.
```shell
tkn taskrun logs --last -f
```
In this section you are going to create your first pipeline, that will include
both the *Hello World!* and *Goodbye World!* tasks.
It may take a few moments before your `Task` completes. When it executes, it should
show the following output:
1. Create a new file named `hello-goodbye-pipeline.yaml` and add the following
content:
```
[goodbye] Goodbye World!
```
```yaml
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: hello-goodbye
spec:
tasks:
- name: hello
taskRef:
name: hello
- name: goodbye
runAfter:
- hello
taskRef:
name: goodbye
```
To create a `Pipeline`, create a Kubernetes object using the Tekton API with
the kind `Pipeline`. The following YAML file specifies a `Pipeline`.
```yaml
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: hello-goodbye
spec:
tasks:
- name: hello
taskRef:
name: hello
- name: goodbye
runAfter:
- hello
taskRef:
name: goodbye
```
1. Apply your pipeline configuration to your cluster:
Write the YAML above to a file named `pipeline-hello-goodbye.yaml`, and apply it to your Kubernetes cluster:
```bash
kubectl apply --filename hello-goodbye-pipeline.yaml
```
```bash
kubectl apply -f pipeline-hello-goodbye.yaml
```
1. Instantiate your pipeline with a `PipelineRun` object. Create a new file
named `hello-goodbye-pipeline-run.yaml` with the following content:
To run this pipeline with Tekton, you need to create a `pipelineRun`, which is
another Kubernetes object used to specify run time information for a `Pipeline`.
```yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: hello-goodbye-run
spec:
pipelineRef:
name: hello-goodbye
```
To view this `pipelineRun` object you can run the following Tekton CLI (`tkn`) command:
1. Start your pipeline by applying the `PipelineRun` configuration to your
cluster:
```shell
tkn pipeline start hello-goodbye --dry-run
```
```bash
kubectl apply --filename hello-goodbye-pipeline-run.yaml
```
After running the command above, the following `PipelineRun` definition should be shown:
You see the following output:
```yaml
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: hello-goodbye-run-
spec:
pipelineRef:
name: hello-goodbye
```
```bash
pipelinerun.tekton.dev/hello-goodbye-run created
```
To use the `pipelineRun` above to start the `echo` `Pipeline`, you can either use
`tkn` or `kubectl`.
Tekton now starts running your pipeline.
Start with `tkn`:
1. To see the logs of the `PipelineRun`, use the following command:
```shell
tkn pipeline start hello-goodbye
```
```bash
tkn pipelinerun logs hello-goodbye-run -f -n default
```
Start with `kubectl`:
The output shows both Tasks completed successfully:
```shell
# use tkn's --dry-run option to save the pipelineRun to a file
tkn pipeline start hello-goodbye --dry-run > pipelineRun-hello-goodbye.yaml
# create the pipelineRun
kubectl create -f pipelineRun-hello-goodbye.yaml
```
<pre>
[hello : hello] Hello World!
Tekton will now start running your `Pipeline`. To see the logs of the `pipelineRun`, run
the following `tkn` command:
[goodbye : goodbye] Goodbye World!
</pre>
```shell
tkn pipelinerun logs --last -f
```
## Cleanup
It may take a few moments before your `Pipeline` completes. When it executes, it should
show the following output:
To delete the cluster that you created for this quickstart run:
```bash
minikube delete
```
[hello : hello] Hello World!
[goodbye : goodbye] Goodbye World!
```
The output confirms that your cluster was deleted:
<pre>
🔥 Deleting "minikube" in docker ...
🔥 Deleting container "minikube" ...
🔥 Removing /home/user/.minikube/machines/minikube ...
💀 Removed all traces of the "minikube" cluster.
</pre>
## Further reading
- [Tasks](/docs/pipelines/tasks)
- [Pipelines](/docs/pipelines/pipelines)
## What's next
Other useful resources
Now you have the core component of Tekton, Tekton Pipelines, installed on
your Kubernetes or OpenShift cluster with the Tekton CLI installed on your local
machine. If you would like to install more components, see the list below:
- [Convenience scripts to run Kind][kind-setup]
- [Instructions to setup Minikube and Docker][local-setup]
* [Tekton Triggers](/docs/triggers)
* [Tekton Dashboard](/docs/dashboard)
[minikube]: https://minikube.sigs.k8s.io/docs/start/
[kind]: https://kind.sigs.k8s.io/docs/user/quick-start/#installation
[kind-setup]: https://github.com/tektoncd/plumbing/tree/main/hack
[kubectl]: https://github.com/tektoncd/pipeline/blob/main/docs/developers/local-setup.md
[local-setup]: https://github.com/tektoncd/pipeline/blob/main/docs/developers/local-setup.md
Learn more about Tekton in [Concepts](/docs/concepts/).
---
title: "Getting started with Tasks"
likTitle: "Tasks"
weight: 1
description: >
Set up and run your first Tekton task
---
This tutorial shows you how to
1. Create a Kubernetes cluster with [minikube](https://minikube.sigs.k8s.io/).
1. Install Tekton pipelines.
1. Create a task.
1. Use `TaskRun` to instantiate and run your task.
## Prerequisites
1. [Install minikube](https://minikube.sigs.k8s.io/docs/start/). You only have
to complete the step 1, "Installation".
1. [Install kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
## Create your Kubernetes cluster
Create a cluster
```bash
minikube start
```
The process takes a few seconds, you see an output symilar to the following,
depending on the [minikube driver](https://minikube.sigs.k8s.io/docs/drivers/)
that you are using:
<pre>
😄 minikube v1.25.1
✨ Using the docker driver based on existing profile
👍 Starting control plane node minikube in cluster minikube
🚜 Pulling base image ...
🔄 Restarting existing docker container for "minikube" ...
🐳 Preparing Kubernetes v1.23.1 on Docker 20.10.12 ...
▪ kubelet.housekeeping-interval=5m
▪ Generating certificates and keys ...
▪ Booting up control plane ...
▪ Configuring RBAC rules ...
🔎 Verifying Kubernetes components...
▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟 Enabled addons: storage-provisioner, default-storageclass
🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
</pre>
You can check that the cluster was successfully created with `kubectl`:
```bash
kubectl cluster-info
```
The output confirms that Kubernetes is running:
<pre>
Kubernetes control plane is running at https://127.0.0.1:39509
CoreDNS is running at
https://127.0.0.1:39509/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
</pre>
## Install Tekton Pipelines
1. To install the latest version of Tekton Pipelines, use `kubectl`:
```bash
kubectl apply --filename \
https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
```
1. Monitor the installation:
```bash
kubectl get pods --namespace tekton-pipelines --watch
```
When all components show `Running` under the `STATUS` column the installation
is complete.
Hit *Ctrl + C* to stop monitoring.
## Create and run a basic task
A **task**, represented in the API as an object of kind `Task`, defines a
series of **steps** that run sequentially to perform logic that the task
requires. Every task runs as a pod on your Kubernetes cluster, with each step
running in its own container.
1. To create a task, open your favorite editor and create a file named
`hello-world.yaml` with the following content:
```yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/bash
echo "Hello World"
```
1. Apply the changes your cluster:
```bash
kubectl apply --filename hello-world.yaml
```
The output confirms that the task was completed successfully.
```bash
task.tekton.dev/hello created
```
1. To run this task, you must instantiate it using `TaskRun`. Create another
file named `hello-world-run.yaml` with the following content:
```yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: hello-task-run
spec:
taskRef:
name: hello
```
1. Apply the changes to your cluster to launch the task:
```bash
kubectl apply --filename hello-world-run.yaml
```
1. Verify that everything worked correctly:
```bash
kubectl get taskrun hello-task-run
```
The output of this command shows the status of the task
<pre>
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
hello-task-run True Succeeded 22h 22h
</pre>
The value `True` under `SUCCEEDED` confirms that TaskRun completed with no errors.
1. Take a look at the logs:
```
kubectl logs --selector=tekton.dev/taskRun=hello-task-run
```
The output displays the message:
```
Hello World
```
## Cleanup
If you want to continue and create a pipeline, do not delete your cluster and
proceed to the [next tutorial](/docs/getting-started/pipelines/).
To delete the cluster that you created for this quickstart run:
```bash
minikube delete
```
The output confirms that your cluster was deleted:
<pre>
🔥 Deleting "minikube" in docker ...
🔥 Deleting container "minikube" ...
🔥 Removing /home/user/.minikube/machines/minikube ...
💀 Removed all traces of the "minikube" cluster.
</pre>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册