Tekton, a powerful and flexible open-source framework, empowers developers to build, test, and deploy CI/CD systems, both in the cloud and on-premises. In this article, we delve deeper into what Tekton is, its advantages, and how major companies such as Google, Elastic, and RedHat leverage it.
Tekton is an open-source framework designed for developing Continuous Integration and Continuous Deployment (CI/CD) systems. It enables developers to work seamlessly with both cloud providers and on-premise infrastructures. With Tekton, developers can build, test, and deploy pipelines, benefiting from a flexible and extensible architecture.
Tekton leverages Kubernetes clusters to manage resources and components. This enables Tekton to run on various cloud providers and be deployed locally.
All resources needed to build a pipeline are available as Kubernetes Custom Resources. This means that pipelines can be fully described in YAML files, allowing GitOps principles to be applied for an automated and version-controlled build process.
The core of Tekton is easily extendable with additional components, such as Tekton Triggers or Dashboards. These components are not directly located in the core, keeping it compact and utilizing minimal resources.
Thanks to Tekton's modular design, the core can be upgraded independently without impacting builds. The separation of the core and extensions makes maintenance much simpler.
As a Cloud-Native solution, Tekton can easily scale for high availability, making it suitable for a variety of projects and environments.
Several leading IT companies have adopted Tekton and actively contribute to its development through a GitHub repository. Some notable companies include:
The Tekton ecosystem consists of diverse components that can be deployed collectively or individually. Below is an explanation of some key components.
Tekton Pipelines utilizes Kubernetes Custom Resources to define build processes. Following the 'pipeline-as-code' principle, developers can describe pipelines in YAML files and apply version control with GitOps.
Storing each resource in Git allows working with versions across different Pipeline resources. Moreover, by applying the GitOps principle, the resource is automatically deployed to the cluster, ensuring assurance in consistently having the correct and latest version without any manual handling of Tekton resources.
A Pipeline is a subset of tasks executed in a specific order.
Let's take an example of a Pipeline for building a Docker image:
Now, let's visualize this.
In the pipeline, we define the tasks. These tasks are also individual Tekton Custom Resources residing in Kubernetes. When executing the pipeline, Tekton consults the defined resource and utilizes it to perform its tasks.
Tasks are quite flexible. You can reuse a task repeatedly within a pipeline and even across different pipelines. Tasks can be modified or written from scratch without the need for separately installing plugins or additional resources. A task can be a simple container image executed with specific parameters.
Applying version control to tasks makes it easy to use a different version of the task for each specific purpose. This eliminates the need to upgrade all pipelines when a task is updated.
Let's create a pipeline as an example that builds a Docker container image and pushes it to a Docker container registry.
First, we will prepare our Tekton tasks so that we can define them in our Tekton pipeline.
What steps are needed to build a Docker container image?
You can find the corresponding YAML files for each of these tasks on the Tekton Hub.
Now that we have our tasks in preparation, we can write our custom Tekton Pipeline.
Tekton Pipeline is constructed from top to bottom.
Now that we have a complete Tekton Pipeline, we can start our pipeline.
For this we need Tekton PipelineRun. Here we are going to define our parameters like:
Deploy the resources to test in order: Tasks, Pipeline and PipelineRun.
Triggers ensure that Tekton Pipelines can be initiated by an event, such as a commit to a repository that then sends a webhook to your Trigger Listener.
There are various options to activate your pipeline from an event.
When we further elaborate on the above diagram and incorporate Tekton Triggers, it looks like this:
Steps:
First we will create our EventListener based on a CEL expression.
In our EventListener we have configured triggers that:
If these fields are correct, he will prepare a template.
We are also going to prepare a TriggerTemplate and TriggerBinding to use parameters during the trigger.
In the TriggerBinding we will extract the Trigger Body and load the variables with body values sent from Webhook.
Now that we have the variables in the TriggerBinding, we can start our Pipeline from TriggerTemplate with our variables coming from Trigger.
We can use the ${tt.xx} notation for this.
Deploy the resources in order to test: TriggerTemplate, TriggerBinding, EventListener.
Observing and managing Tekton resources within a Kubernetes environment is not always straightforward, especially considering developers often have restricted access rights in the Kubernetes environment.
For this reason, utilizing Tekton Dashboards is recommended. Tekton Dashboard serves as an extension to the Tekton ecosystem, offering a user-friendly web interface for the administration and monitoring of Tekton resources in Kubernetes environments. It facilitates developers in tracking pipelines, monitoring real-time logs, and verifying task statuses. Consequently, developers can promptly identify the reasons for build failures and their specific locations.
Tekton offers an extensive range of pipelines and tasks readily available. While developers can write pipelines or tasks from scratch, they also have the option to adopt tasks and pipelines from the Tekton Hub. The resources acquired from the Hub can be customized as needed.
This provides flexibility for developers, allowing them to refrain from adhering strictly to predefined resources and instead fully rewrite their resources according to their preferences.
Some key tasks available from the Hub include:
More tasks are accessible at https://hub.tekton.dev/.
For developers looking to utilize Tekton, the official Tekton-documentation provides detailed information on installation and configuration.
In conclusion, Tekton offers a powerful, flexible, and scalable solution for CI/CD processes. With its CloudNative characteristics, extensibility, and support from major companies, Tekton has established itself as a reliable framework for developers.
Do you want to experience the benefits of Tekton in practice and discover how ACA Group can provide innovative solutions for your IT challenges?
Feel free to contact our experts for personalized advice and a seamless implementation.