Getting started with Tasks

Set up and run your first Tekton task

This tutorial shows you how to

  1. Create a Kubernetes cluster with minikube.
  2. Install Tekton pipelines.
  3. Create a task.
  4. Use TaskRun to instantiate and run your task.


  1. Install minikube. You only have to complete the step 1, “Installation”.
  2. Install kubectl

Create your Kubernetes cluster

Create a cluster

minikube start

The process takes a few seconds, you see an output symilar to the following, depending on the minikube driver that you are using:

πŸ˜„  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
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

You can check that the cluster was successfully created with kubectl:

kubectl cluster-info

The output confirms that Kubernetes is running:

Kubernetes control plane is running at
CoreDNS is running at

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Install Tekton Pipelines

  1. To install the latest version of Tekton Pipelines, use kubectl:

    kubectl apply --filename \
  2. Monitor the installation:

    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:

    kind: Task
      name: hello
        - name: echo
          image: alpine
          script: |
            echo "Hello World"        
  2. Apply the changes your cluster:

    kubectl apply --filename hello-world.yaml

    The output confirms that the task was completed successfully. created
  3. To run this task, you must instantiate it using TaskRun. Create another file named hello-world-run.yaml with the following content:

    kind: TaskRun
      name: hello-task-run
        name: hello
  4. Apply the changes to your cluster to launch the task:

    kubectl apply --filename hello-world-run.yaml
  5. Verify that everything worked correctly:

    kubectl get taskrun hello-task-run

    The output of this command shows the status of the task

     NAME                               SUCCEEDED    REASON       STARTTIME   COMPLETIONTIME
     hello-task-run          True         Succeeded    22h         22h

    The value True under SUCCEEDED confirms that TaskRun completed with no errors.

  6. Take a look at the logs:

    kubectl logs

    The output displays the message:

    Hello World


If you want to continue and create a pipeline, do not delete your cluster and proceed to the next tutorial.

To delete the cluster that you created for this quickstart run:

minikube delete

The output confirms that your cluster was deleted:

πŸ”₯  Deleting "minikube" in docker ...
πŸ”₯  Deleting container "minikube" ...
πŸ”₯  Removing /home/user/.minikube/machines/minikube ...
πŸ’€  Removed all traces of the "minikube" cluster.

Last modified April 13, 2022: Fix example task (cc425d8)