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 the Task.

Prerequisites

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

  2. Install kubectl.

Create a Kubernetes cluster

Create a cluster:

minikube start --kubernetes-version v1.33.1 

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

๐Ÿ˜„ minikube v1.36.0 on Darwin 15.5 (arm64) โœจ Using the qemu2 driver based on user configuration ๐ŸŒ Automatically selected the builtin network ๐Ÿ‘ Starting "minikube" primary control-plane node in "minikube" cluster ๐Ÿ”ฅ Creating qemu2 VM (CPUs=2, Memory=6000MB, Disk=20000MB) ... ๐Ÿ“ฆ Preparing Kubernetes v1.33.1 on containerd 1.7.23 ... โ–ช Generating certificates and keys ... โ–ช Booting up control plane ... โ–ช Configuring RBAC rules ... ๐Ÿ”— Configuring bridge CNI (Container Networking Interface) ... ๐Ÿ”Ž Verifying Kubernetes components... โ–ช Using image gcr.io/k8s-minikube/storage-provisioner:v5 ๐ŸŒŸ Enabled addons: default-storageclass, storage-provisioner ๐Ÿ„ 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 https://localhost:64858 CoreDNS is running at https://localhost:64858/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy 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 \ https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml 
  2. Monitor the installation:

    kubectl get pods --namespace tekton-pipelines --watch 

    When both tekton-pipelines-controller and tekton-pipelines-webhook show 1/1 under the READY column, you are ready to continue. For example:

    NAME READY STATUS RESTARTS AGE tekton-events-controller-786b59d5cd-jt7d9 0/1 Running 0 2s tekton-pipelines-controller-59b6cdbbc-2kw2w 0/1 Running 0 2s tekton-pipelines-webhook-74b5cdfcc4-g4qj2 0/1 Running 0 2s tekton-pipelines-controller-59b6cdbbc-2kw2w 1/1 Running 0 11s tekton-events-controller-786b59d5cd-jt7d9 1/1 Running 0 11s tekton-pipelines-webhook-74b5cdfcc4-g4qj2 1/1 Running 0 11s 

    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 the 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:

    apiVersion: tekton.dev/v1 kind: Task metadata:  name: hello spec:  steps:  - name: echo  image: alpine  script: |  #!/bin/sh  echo "Hello World" 
  2. Apply the changes to your cluster:

    kubectl apply --filename hello-world.yaml 

    The output confirms that the Task was created successfully:

    task.tekton.dev/hello created 
  3. A TaskRun object instantiates and executes this Task. Create another file named hello-world-run.yaml with the following content:

    apiVersion: tekton.dev/v1 kind: TaskRun metadata:  name: hello-task-run spec:  taskRef:  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 28s 3s 

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

  6. Take a look at the logs:

    kubectl logs --selector=tekton.dev/taskRun=hello-task-run 

    The output displays the message:

    Hello World 

Cleanup

To learn about Tekton Pipelines, skip this section and proceed to the next tutorial.

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

minikube delete 

The output confirms that the cluster was deleted:

๐Ÿ”ฅ Deleting "minikube" in qemu2 ... ๐Ÿ’€ Removed all traces of the "minikube" cluster. 

Further Reading:

We recommend that you complete Getting started with Pipelines.

For more complex examples see:


Last modified July 22, 2025: feat: refresh getting started (aa6e0f7)