Skip to main content

Tekton

Tekton

Official Documentation

Tekton is a cloud native solution for building CI/CD systems and is fully open source. It is part of the CNCF and developed specifically to run on Kubernetes.

It has a set of Kubernetes custom resources that define the building blocks you can create and reuse for your pipelines. Once installed, Tekton Pipelines is available through the Kubernetes CLI (kubectl) and through API calls, just like pods and other resources.

Advantages​

  • Customizable. Tekton entities are fully customizable, allowing a high degree of flexibility. Platform engineers can define a highly detailed catalog of building blocks for developers to use in a wide variety of scenarios.

  • Reusable. Tekton entities are fully portable, so once defined, anyone within the organization can use a specific pipeline and reuse its building blocks. This allows developers to quickly create complex pipelines without "reinventing the wheel".

  • Expandable. The Tekton Catalog is a community-driven repository of Tekton building blocks. You can quickly create new pipelines and expand existing pipelines using pre-made components from the Tekton Catalog.

  • Standardized. Tekton is installed and runs as an extension in your Kubernetes cluster and uses the well-established Kubernetes resource model. Tekton workloads run inside Kubernetes containers.

  • Scalable. To increase your workload capacity, you can simply add nodes to your cluster. Tekton scales with your cluster without needing to redefine your resource allocations or any other modifications to your pipelines.

Components​

The controllers work on top of custom objects extending the kubernetes api through CRDs.

Tekton Pipelines is the foundation of Tekton. It defines a set of Kubernetes Custom Resources that act as building blocks from which you can assemble CI/CD pipelines.

Tekton Triggers are the events that generate pipelines - for example a pull request or specific triggers created in the dashboard.

Tekton CLI (tkn) created on top of the Kubernetes CLI, which allows you to interact with Tekton.

Tekton Dashboard is a web-based graphical interface for Tekton Pipelines that displays information about your pipeline executions.

Tekton Catalog is a repository of community-contributed Tekton building blocks for code reuse to generate pipelines.

Tekton Hub is a web-based graphical interface for accessing the Tekton Catalog.

Tekton Chain provides tools to generate, store and sign the provenance of artifacts built with Tekton Pipelines.

Tekton has few things, but with a lot of power which makes it easy to learn, combined with the catalog it helps a lot for the team to absorb the tool.

Concepts​

Steps are the smallest part of a pipeline. Each step receives a specific set of inputs and produces a specific set of outputs that can be used as inputs in the next step. Every step belongs to a task and a task has its own pod in kubernetes, so if the steps are from the same task they run in the same pod. Each step will be a container inside the task's pod.

Tasks are an ordered series of steps. A task can also receive inputs and generate outputs for the following tasks. Each Task runs in its own Kubernetes Pod. Tasks within a Pipeline do not share data. For this you must explicitly configure each Task to make its outputs as inputs in the next task if necessary. Each task is a pod that can have several containers (steps).

Note that steps generate inputs and outputs for steps and tasks generate inputs and outputs for tasks.

Pipelines are an ordered series of tasks.

Tasks can be used for simple things and pipelines take a set of tasks and create something complex.

TaskRuns and PipelineRuns​

A pipelineRun is a specific execution of a pipeline. For example, you can ask Tekton to run your CI/CD workflow twice a day, and each run will become a trackable pipelineRun resource in your Kubernetes cluster. You can view the status of your CI/CD workflow, including the specifications of each task run with pipelineRuns. We can have a created pipeline and instantiate it with inputs for different environments. The pipeline code becomes the same but they do all the work with different inputs.

A taskRun is a specific execution of a task. TaskRuns are also available when you choose to run a task outside of a pipeline, with which you can view the specifics of each step execution in a task. Think of tasks as functions that receive parameters, that is, it's something generic and the TaskRun if we had instantiated it with the correct parameters.

TaskRuns and pipelineRuns connect resources with tasks and pipelines. A run must include the actual addresses of resources, such as repository URLs, your task or pipeline needs. This design allows developers to reuse tasks and pipelines for different inputs and outputs.

alt text

How does it work?​

Every pod that tekton creates has an entrypoint to keep the pod alive. It receives the steps and executes when the container is ready. At the end it dies and disappears.

All pipeline state is tracked through pod annotations that are projected into each of the containers that exist in it.

Some extra containers are scheduled in the pods to mark the before and after of the containers that actually execute the steps. They serve to mark the start and end of execution.

We know that pods share volumes internally very easily which makes tekton very effective.

Tekton Vs Argo Workflow​

These two tools are very similar even in the declaration of manifests, they do the same thing but with different names. The advantage I see in Tekton is a more engaged community providing better quality ready-made tasks for code reuse.

Argo Workflow Catalog is the competitor to TektonHub. See the difference between them.

There are other tools available, usually Tekton is used to create something much more elaborate.