Tekton
Tekton
A Kubernetes-native CI/CD framework. Pipeline building blocks.
Tekton
A Kubernetes-native CI/CD framework. Pipeline building blocks.
Tekton is a Kubernetes-native CI/CD framework that Google started in 2018 based on Knative Build and later donated to the CD Foundation. It defines pipelines declaratively using Custom Resource Definitions (CRDs) and runs directly on a Kubernetes cluster.
Its core concepts are Task (an individual job), TaskRun (an execution instance of a Task), Pipeline (a combination of Tasks), and PipelineRun (an execution instance of a Pipeline). Each Task consists of multiple Steps, and the Steps run sequentially within the same Pod. Data is shared between Tasks through a Workspace.
Tekton runs container image builds, tests, and deployments all as Kubernetes Pods. Each Step runs in a separate container, which ensures isolation. With Tekton Triggers, pipelines can be run automatically by various events such as Git webhooks and HTTP requests.
In practice, teams quickly assemble pipelines by pulling reusable Tasks from Tekton Hub. They combine it with Argo CD or Flux to implement GitOps CI/CD, or use OpenShift Pipelines in enterprise environments. Jenkins X is also based on Tekton.
# Tekton Task ์ ์
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-and-push
spec:
params:
- name: image
type: string
description: ๋น๋ํ ์ด๋ฏธ์ง ์ด๋ฆ
workspaces:
- name: source
description: ์์ค ์ฝ๋ workspace
steps:
- name: build
image: gcr.io/kaniko-project/executor:latest
command:
- /kaniko/executor
args:
- --dockerfile=$(workspaces.source.path)/Dockerfile
- --context=$(workspaces.source.path)
- --destination=$(params.image)
---
# Pipeline ์ ์
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: ci-pipeline
spec:
params:
- name: repo-url
type: string
- name: image-name
type: string
workspaces:
- name: shared-workspace
tasks:
- name: fetch-source
taskRef:
name: git-clone # Tekton Hub์์ ์ค์น
workspaces:
- name: output
workspace: shared-workspace
params:
- name: url
value: $(params.repo-url)
- name: run-tests
taskRef:
name: npm-test
runAfter:
- fetch-source
workspaces:
- name: source
workspace: shared-workspace
- name: build-push
taskRef:
name: build-and-push
runAfter:
- run-tests
workspaces:
- name: source
workspace: shared-workspace
params:
- name: image
value: $(params.image-name)
---
# PipelineRun์ผ๋ก ์คํ
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: ci-pipeline-run-
spec:
pipelineRef:
name: ci-pipeline
params:
- name: repo-url
value: https://github.com/myorg/myapp
- name: image-name
value: registry.io/myapp:latest
workspaces:
- name: shared-workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Senior: "I looked into migrating from Jenkins to Tekton, and managing pipelines as Kubernetes resources fits well with our GitOps flow."
Junior: "I heard Tasks can be reused. Can I just pull them from Tekton Hub?"
Senior: "Yes, things like git-clone and kaniko-build can be installed straight from the Hub with tkn hub install."
Interviewer: "What are the main differences between Tekton and Jenkins?"
Candidate: "Tekton defines pipelines with Kubernetes CRDs, so the cluster itself is the CI server. Since Tasks run as Pods, scaling comes naturally, and declarative YAML makes version control easy. Jenkins, on the other hand, requires managing a separate server and is based on Groovy scripts, so its complexity is higher."
Take a mock interview on this topic โ WIA SOOM AI Interview ยท Start for free
Reviewer: "You used emptyDir for the workspace in the PipelineRun, but debugging can be difficult when a build fails."
Developer: "If we use a PVC via volumeClaimTemplate, we could check the data even for failed builds. I'll also add a finally task to include cleanup logic."