Инсталляция Tekton в ubuntu 22.04


Делаю:
2024.03.08


Инсталляция Tekton CLI


$ mkdir ~/tmp
$ cd ~/tmp/


$ vi tekton-setup.sh


#!/bin/bash

export LATEST_VERSION=$(curl --silent "https://api.github.com/repos/tektoncd/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')

export LATEST_VERSION_SHORT=$(curl --silent "https://api.github.com/repos/tektoncd/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)

curl -LO "https://github.com/tektoncd/cli/releases/download/${LATEST_VERSION}/tkn_${LATEST_VERSION_SHORT}_$(uname -s)_$(uname -m).tar.gz"

sudo tar xvzf tkn_${LATEST_VERSION_SHORT}_$(uname -s)_$(uname -m).tar.gz -C /usr/local/bin/ tkn


$ bash tekton-setup.sh
$ tkn version
Client version: 0.35.1


Добавляем Tekton CRD в MiniKube


$ kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml


$ tkn version
Client version: 0.35.1
Pipeline version: v0.57.0


$ kubectl get pods -n tekton-pipelines
NAME                                           READY   STATUS    RESTARTS   AGE
tekton-events-controller-77857f9b75-j26z2      1/1     Running   0          43s
tekton-pipelines-controller-6987c95899-5sxm5   1/1     Running   0          43s
tekton-pipelines-webhook-7f556bb7d9-kbn2t      1/1     Running   0          43s


$ kubectl get pods -n tekton-pipelines-resolvers
NAME                                                READY   STATUS    RESTARTS   AGE
tekton-pipelines-remote-resolvers-f94cc8475-6dmnx   1/1     Running   0          59s


$ kubectl get crds
NAME                                       CREATED AT
clustertasks.tekton.dev                    2024-03-08T10:02:41Z
customruns.tekton.dev                      2024-03-08T10:02:41Z
pipelineruns.tekton.dev                    2024-03-08T10:02:41Z
pipelines.tekton.dev                       2024-03-08T10:02:41Z
resolutionrequests.resolution.tekton.dev   2024-03-08T10:02:41Z
stepactions.tekton.dev                     2024-03-08T10:02:41Z
taskruns.tekton.dev                        2024-03-08T10:02:41Z
tasks.tekton.dev                           2024-03-08T10:02:41Z
verificationpolicies.tekton.dev            2024-03-08T10:02:41Z


Добавление Tekton Dashboard в MiniKube (Если нужно)


$ kubectl apply --filename https://storage.googleapis.com/tekton-releases/dashboard/latest/release.yaml


Подключиться к dashboard


$ kubectl --namespace tekton-pipelines port-forward svc/tekton-dashboard 8080:9097


$ localhost:8080


Installing Tekton Triggers (Если нужно)


// Install the trigger custom resource definitions (CRDs)
$ kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml

// An interceptor is an object that contains the logic necessary to validate and filter webhooks coming from various sources.
$ kubectl apply -f https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml


// Examples
$ kubectl apply -f https://raw.githubusercontent.com/tektoncd/triggers/main/examples/rbac.yaml


Now that Triggers is installed, you will be able to listen for events from GitHub, but for the webhooks to reach your cluster, you will need to expose a route to the outside world.


$ kubectl get pods -n tekton-pipelines
NAME                                                READY   STATUS    RESTARTS   AGE
tekton-events-controller-77857f9b75-j26z2           1/1     Running   0          2m24s
tekton-pipelines-controller-6987c95899-5sxm5        1/1     Running   0          2m24s
tekton-pipelines-webhook-7f556bb7d9-kbn2t           1/1     Running   0          2m24s
tekton-triggers-controller-5b6d5f54b7-r5rvt         1/1     Running   0          36s
tekton-triggers-core-interceptors-f58696689-x8crk   1/1     Running   0          30s
tekton-triggers-webhook-689688fc54-d7964            1/1     Running   0          36s


$ tkn version
Client version: 0.35.1
Pipeline version: v0.57.0
Triggers version: v0.26.1
Dashboard version: v0.44.0