tekton部署

官网:https://tekton.dev/docs/installation/pipelines/

要求

  • 集群启用rbac鉴权
  • 有管理员权限(绑定了clusterrole/cluster-admon)的用户

部署

1)下载所有清单

mkdir tekton
cd !$

export https_proxy=http://frp1.freefrp.net:16324
url_list=(
  https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
  https://storage.googleapis.com/tekton-releases/dashboard/latest/release-full.yaml
  https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml
  https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml
  https://github.com/tektoncd/cli/releases/download/v0.32.2/tkn_0.32.2_Linux_x86_64.tar.gz
)
for url in ${url_list[*]} ;do
  for i in {1..3} ;do
    wget -q --show-progress $url && break ||echo "下载失败,正在重试$i:  $url";
  done
done
mv release.yaml.1 triggers-release.yaml
unset https_proxy

wget https://files.cnblogs.com/files/blogs/731344/rep-docker-img.sh
sh rep-docker-img.sh
sed -ri '/-entrypoint-image/s#gcr.io/#m.daocloud.io/gcr.io/#g' release.yaml
sed -ri '/-el-image/s#gcr.io/#m.daocloud.io/gcr.io/#g' triggers-release.yaml

2)部署tekton

kubectl apply -f release.yaml

3)部署图形界面

kubectl apply -f release-full.yaml

kubectl patch svc -n tekton-pipelines tekton-dashboard -p '{"spec":{"externalIPs":["2.2.2.55"]}}'

4)部署trigger

kubectl apply -f triggers-release.yaml
kubectl apply -f interceptors.yaml

5)安装cli

tar xf tkn_0.32.2_Linux_x86_64.tar.gz -C /usr/local/bin/ tkn
tkn completion bash > /etc/bash_completion.d/tkn
bash

6)测试

kubectl apply -f - <<eof
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello
spec:
  steps:
    - name: echo
      image: alpine
      script: |
        #!/bin/sh
        echo "Hello World"
---
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: hello-task-run
spec:
  taskRef:
    name: hello
eof

kubectl logs --selector=tekton.dev/taskRun=hello-task-run

tkn taskrun delete hello-task-run -f
tkn task delete hello -f 

image-20240103154221133

图形界面查看image-20240103175156944

posted @ 2024-01-04 20:25  suyanhj  阅读(15)  评论(0编辑  收藏  举报