liveBook · Manning

TaskRun

As explained in Platform Engineering on Kubernetes

A TaskRun is a Tekton resource that represents one execution of a Tekton task.

A TaskRun is a Tekton resource representing one execution of a Task. A Task defines the container and commands; a TaskRun supplies execution-time values and selects the Task through taskRef. section 3.5.1

Applying a Task definition only makes it available to Tekton; it does not run it. Applying a TaskRun starts the execution in the cluster, and the task can be executed repeatedly by creating additional TaskRuns. section 3.5.1

Listing 3.2 A task run represents an instance of our task definition
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  name: hello-world-task-run-1
spec:
  params: 
  - name: name
    value: "Building Platforms on top of Kubernetes reader!"  #1
  taskRef:
    name: hello-world-task                                    #2

A minimal TaskRun names a task with taskRef and passes the name parameter used by the Task. section 3.5.1

Use Kubernetes and Tekton resources to inspect an execution:

  • Apply the manifest with kubectl apply -f taskrun.yaml to start the run. section 3.5.1
  • Run kubectl get taskrun to inspect status, start time, and completion time. section 3.5.1
  • Inspect the associated pod and follow its logs to see the task output. section 3.5.1

Each TaskRun creates a pod for the task. When a PipelineRun executes a pipeline, Tekton creates one TaskRun and one pod per pipeline task, making TaskRuns the concrete executions orchestrated by a pipeline. section 3.5.2 section 3.5.1

Inspecting a completed run

A successful kubectl get taskrun result reports SUCCEEDED as True. The corresponding pod reaches Completed, and kubectl logs can show output such as “Hello World: Building Platforms on top of Kubernetes reader!”. section 3.5.1

How Platform Engineering on Kubernetes covers it

How deep it goes
Explains manifest structure, application, repeated execution, pod creation, status inspection, and log access.
Examples
Demonstrates a hello-world TaskRun, kubectl status output, generated pods, and task logs.
What it assumes
Assumes a Kubernetes cluster with Tekton installed and a Task definition already applied.
What you can do after
Operate/configure a TaskRun, launch it with kubectl, inspect completion, and diagnose output through its pod logs.
How it connects
Connects TaskRun with Task, Pipeline, PipelineRun, Kubernetes pod, kubectl, and Tekton dashboard.

This explainer was generated by Manning's knowledge graph from the text of Platform Engineering on Kubernetes. The section links point to the parts of the book it draws on.