Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
Know it before you install
A Task is a list of steps (containers) that run in one Pod. A Pipeline connects Tasks (order, parameters, results). A PipelineRun/TaskRun is one execution. Workspaces share files between Tasks (a PVC). Resolvers load Tasks from Git, bundles or the Artifact Hub catalog. Triggers start runs from webhooks.
| Item | Value |
|---|---|
| Install | release YAML from the Tekton docs (Pipelines, Triggers, Dashboard, Chains), or the Tekton Operator / OpenShift Pipelines |
| Namespace | tekton-pipelines |
| CLI | tkn (from github.com/tektoncd/cli/releases, .rpm/.deb) |
| Objects | Task, Pipeline, TaskRun, PipelineRun, EventListener, TriggerTemplate |
| Needs | a Kubernetes cluster with a default StorageClass (for workspaces) |
Install Tekton Pipelines and tkn
Apply the current release (check tekton.dev/docs/installation/pipelines for the download address of your version):
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
kubectl -n tekton-pipelines get pods --watch
tekton-pipelines-controller-… 1/1 Running
tekton-pipelines-webhook-… 1/1 RunningThe CLI (RHEL and Ubuntu) — the .rpm/.deb or the tarball from the tektoncd/cli releases:
First configuration: a namespace, a service account, registry access
kubectl create namespace ci
kubectl -n ci create secret docker-registry harbor-push --docker-server=harbor.example.com --docker-username='robot$shop+ci' --docker-password='ROBOT_SECRET'
kubectl -n ci create serviceaccount pipeline
kubectl -n ci patch serviceaccount pipeline -p '{"secrets":[{"name":"harbor-push"}]}'Pipelines run with this service account — give it only the rights the pipeline needs (no cluster-admin).
Tasks and a Pipeline
A Task that runs the tests:
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: run-tests
namespace: ci
spec:
workspaces:
- name: source
steps:
- name: test
image: docker.io/library/python:3.12-slim
workingDir: $(workspaces.source.path)
securityContext:
runAsNonRoot: true
runAsUser: 1000
script: |
pip install --user -r requirements.txt
python -m pytest -qThe Pipeline: clone (catalog Task git-clone through the hub resolver) → test → build and push with Buildah (catalog Task buildah):
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: shop-ci
namespace: ci
spec:
params:
- name: repo-url
- name: revision
default: main
- name: image
workspaces:
- name: shared
tasks:
- name: clone
taskRef:
resolver: hub
params:
- { name: kind, value: task }
- { name: name, value: git-clone }
- { name: version, value: "0.9" }
params:
- { name: url, value: $(params.repo-url) }
- { name: revision, value: $(params.revision) }
workspaces:
- { name: output, workspace: shared }
- name: test
runAfter: [clone]
taskRef:
name: run-tests
workspaces:
- { name: source, workspace: shared }
- name: build
runAfter: [test]
taskRef:
resolver: hub
params:
- { name: kind, value: task }
- { name: name, value: buildah }
- { name: version, value: "0.9" }
params:
- { name: IMAGE, value: $(params.image) }
workspaces:
- { name: source, workspace: shared }kubectl apply -f tasks/run-tests.yaml -f pipeline.yaml
tkn pipeline start shop-ci -n ci --serviceaccount pipeline -p repo-url=https://github.com/ORG/shop.git -p image=harbor.example.com/shop/api:$(date +%Y%m%d%H%M) -w name=shared,volumeClaimTemplateFile=pvc.yaml --showlog(pvc.yaml is a small PersistentVolumeClaim template, for example 1 Gi ReadWriteOnce. Check the catalog Task versions you use and pin them.)
| Part | Why |
|---|---|
Workspace with volumeClaimTemplate | Each run gets its own fresh volume, deleted with the run. |
resolver: hub + version | Reuse tested catalog Tasks, pinned to a version. |
runAfter | Order between Tasks (others run in parallel). |
| Steps as non-root | Pipelines are code from developers — they should not run as root in the cluster. |
Daily use: the commands and the real uses
tkn pipelinerun list -n ci
tkn pipelinerun logs -f -n ci --last
tkn pipelinerun describe -n ci --last
tkn taskrun list -n ci
tkn pipeline list -n ci
tkn pipelinerun cancel shop-ci-run-x7k2p -n ci
tkn pipelinerun delete -n ci --keep 20Add Tekton Triggers (an EventListener with a GitHub/GitLab interceptor) to start runs on push, the Dashboard for a web view, and Tekton Chains to sign images and attach SLSA provenance automatically.
Real uses at work:
- CI/CD fully inside Kubernetes, scaling with the cluster (OpenShift Pipelines).
- Platform teams offer standard pipelines; app teams run them with parameters.
- Supply-chain security: signed images and provenance with Chains.
Make it safe
Security checklist:
- A dedicated service account per pipeline with minimal RBAC; registry robot accounts, not personal logins.
- No privileged steps: build with Buildah/kaniko without privileges; non-root steps; Pod Security on the
cinamespace. - Pin catalog Tasks and step images (version or digest).
- Triggers: verify webhook secrets (interceptors) — otherwise anyone can start pipelines.
- Clean old runs (
--keep, pruner) — they hold logs and volumes. - Chains for signed, traceable builds.
Update and remove
Apply the release YAML of the new version (read the upgrade notes: API versions change), then upgrade tkn. Remove: kubectl delete -f <the same release.yaml>.
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
PipelineRun stays Pending: PVC not bound | No default StorageClass. | Set a default StorageClass, or name one in the claim template. |
unauthorized when pushing the image | The service account has no registry secret. | Link the docker-registry secret to the service account. |
| Resolver error: task not found | Wrong name/version in the hub, or no internet from the cluster. | Check the catalog; use a Git resolver or a bundle in your registry. |
Step fails: permission denied | Non-root step writes to a root-owned path. | Write to the workspace or $HOME; set fsGroup on the Pod template. |
PipelineRun timed out | Default timeout (1 h) reached. | Set timeouts.pipeline on the run; speed up steps (caches). |
| Admission webhook errors on apply | Tekton webhook Pod down. | kubectl -n tekton-pipelines get pods; check its logs. |
Next steps
- Quick how-tos: Run a pipeline.
- The image build inside it: Buildah / Skopeo. Sign the result: Cosign.
- Deploy after the build: Argo CD, Flux.
- Other CI engines: Jenkins, GitLab Runner, GitHub runner.
1Where do the steps of a Tekton Task run?
As containers in one Kubernetes Pod per TaskRun.
2How do Tasks in a Pipeline share the cloned source code?
Through a workspace (for example a PVC from a volumeClaimTemplate).