Cloud Native 11 min read

Getting Started with Tekton: Installation, Core Concepts, and a Sample CI Pipeline

This guide walks through installing Tekton on a Kubernetes cluster, explains its core CRD resources such as Task, TaskRun, Pipeline and PipelineResource, and demonstrates a complete example that clones a Go repository, runs tests, builds a Docker image, and pushes it to Docker Hub.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Getting Started with Tekton: Installation, Core Concepts, and a Sample CI Pipeline

Tekton is a powerful, flexible open‑source cloud‑native CI/CD framework that originated from the Knative build‑pipeline project and now provides a standardized solution for building pipelines on Kubernetes.

Installation : With a running Kubernetes cluster (e.g., v1.16.2), Tekton can be installed by applying the official release YAML:

$ kubectl apply -f https://github.com/tektoncd/pipeline/releases/download/v0.12.0/release.yaml

If the default GCR images are unreachable, an alternative manifest that uses Docker Hub images can be applied:

$ kubectl apply -f https://raw.githubusercontent.com/cnych/qikqiak.com/master/data/manifests/tekton/release.yaml

After installation, the tekton-pipelines namespace is created; verify the pods are running with kubectl get pods -n tekton-pipelines. Optionally, install the Tekton CLI via Homebrew on macOS:

$ brew tap tektoncd/tools
$ brew install tektoncd/tools/tektoncd-cli

Confirm the CLI installation with tkn version.

Core Concepts : Tekton defines several CRDs:

Task – a template of steps to execute (e.g., compile, build, push).

TaskRun – an actual execution of a Task.

Pipeline – an ordered collection of Tasks and resources.

PipelineRun – an execution of a Pipeline.

PipelineResource – inputs or outputs for a Pipeline, such as a Git repo or a container image.

Example Walkthrough :

1. Create a Task that clones a Go repository and runs go test:

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: test
spec:
  resources:
    inputs:
    - name: repo
      type: git
  steps:
  - name: run-test
    image: golang:1.14-alpine
    workingDir: /workspace/repo
    command: ["go"]
    args: ["test"]

Apply it with kubectl apply -f task-test.yaml.

2. Define a PipelineResource of type git pointing to the demo repository:

apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
  name: cnych-tekton-example
spec:
  type: git
  params:
  - name: url
    value: https://github.com/cnych/tekton-demo
  - name: revision
    value: master

Apply it with kubectl apply -f pipelineresource.yaml.

3. Create a TaskRun that references the Task and the Git resource:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: testrun
spec:
  taskRef:
    name: test
  resources:
    inputs:
    - name: repo
      resourceRef:
        name: cnych-tekton-example

Apply with kubectl apply -f taskrun.yaml and monitor progress using kubectl get taskrun, kubectl get pods, or kubectl logs. When the pod reaches Completed, the TaskRun shows SUCCEEDED: True and the test output (e.g., PASS) appears in the logs.

Alternatively, the Tekton CLI can start the Task and stream logs in one step:

$ tkn task start test --inputresource repo=cnych-tekton-example --showlog

Summary : The article demonstrates installing Tekton on Kubernetes, defining a Task, PipelineResource, and TaskRun, executing the pipeline, and verifying results via kubectl and the Tekton CLI. The next steps would involve adding a Docker build task, pushing the image to Docker Hub, and chaining tasks into a full pipeline.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud Nativeci/cdDevOpstekton
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.