Tekton 介绍
Tekton 最初被称为 Knative Build,后来被重组为独立的开源项目,有自己的 治理组织,现在是属于 Linux 基金会 的项目。
Tekton 提供了一个集群内的容器image构建和部署工作流程,换句话说,它是一个 <ruby>持续集成</ruby>(CI)和 <ruby>持续交付</ruby>(CD)服务。它由 Tekton 流水线和几个支持组件如 Tekton CLI、Triggers 和 Catalog 等组成。
Tekton 是一个 Kubernetes 原生应用。它在 Kubernetes 集群中作为扩展被安装和运行,由一套Kubernetes 定制化资源组成,定义了你为流水线创建和复用的构建块。由于 Tekton 是一种 Kubernetes 原生技术,所以它非常容易扩展。当你需要增加你的工作负载时,你只需向你的集群添加节点就可以了。由于其可扩展的设计和社区贡献的组件库,它也很容易定制。
对于需要 CI/CD 系统来开展工作的开发人员,和为其组织内的开发人员建立 CI/CD 系统的平台工程师,Tekton 是理想选择。
Tekton 安装
安装需要一个k8s集群,这里选择minikube安装一个单节点k8s,进行安装演示
Tekton的安装非常简单,官方已经将具体的安装文件准备好了,命令如下(域名自行加上协议头)
kubectl apply -f storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
但是在国内环境下,直接安装是失败的,直接下载yaml文件可以看到,里面涉及了8个image文件,都是gro.io,这个在国内是无法访问的。
一般有几种做法:
1 :科学上网,这个是最直接的,
2:找个国内的image仓库,但是tekton没那么热门,很多大的国内仓库没有同步,
3:自己下载,上传到自己国内的image仓库
这里介绍一下方式3,避免大家安装的时候遇到的坑
安装准备
这里安装tekton 0.50.0版本,要求k8s需要1.24.0以上,要求一个可以上外网的机器/环境,且该机器安装了docker
安装步骤
1:下载安装yaml (域名自行加上协议头)
wget storage.googleapis.com/tekton-releases/pipeline/previous/v0.50.0/release.yaml
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.50.0@sha256:582f4eae20d77e4bc9b6e24d6d1ea97d457e6a50ac7205519bb6b4856093d856
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.50.0
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.50.0@sha256:a048ec206f615e8532798190bbedf11195eeac7abc099851c0ef42a64a1c8e68
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/sidecarlogresults:v0.50.0@sha256:6f12e4223a8b78a5024437eb889a7d947a5807cb76cb72b40b2f8030796d6e60
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/workingdirinit:v0.50.0
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/events:v0.50.0@sha256:9f90f568a7f56c3e418f3d25fb87fb73ad5bd52632a769f4ec8b8ba874495337
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/resolvers:v0.50.0
docker pull gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook:v0.50.0@sha256:8ca5c85f62307fe753624de443deb3a4cc4b8dcc735c3971068820e14030c69c
docker save -o tekton.controller.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.50.0
docker save -o tekton.entrypoint.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.50.0
docker save -o tekton.nop.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.50.0
docker save -o tekton.sidecarlogresults.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/sidecarlogresults:v0.50.0
docker save -o tekton.workingdirinit.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/workingdirinit:v0.50.0
docker save -o tekton.events.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/events:v0.50.0
docker save -o tekton.resolvers.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/resolvers:v0.50.0
docker save -o tekton.webhook.v0.50.0 gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook:v0.50.0
docker load < tekton.controller.v0.50.
docker load < tekton.entrypoint.v0.50.0
docker load < tekton.nop.v0.50.0
docker load < tekton.resolvers.v0.50.0
docker load < tekton.sidecarlogresults.v0.50.0
docker load < tekton.webhook.v0.50.0
docker load < tekton.events.v0.50.0
docker load < tekton.workingdirinit.v0.50.0
使用docker images 查看image列表,发现有一些丢失了tag和repo信息,需要补充
使用 docker tag IMAGEID TARGET_IMAGE:TAG 命令补充
docker tag ef4a4116db5c gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/events:v0.50.0
docker tag 8a694b820e0b gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/resolvers:v0.50.0
docker tag c79b114e705b gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook:v0.50.0
docker tag fa07eb34297a gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/sidecarlogresults:v0.50.0
docker tag f4be3380448f gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/workingdirinit:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/resolvers:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/sidecarlogresults:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/events:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/workingdirinit:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.50.0
minikube image load gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook:v0.50.0
用 0.50.0的yaml安装
wget storage.googleapis.com/tekton-releases/pipeline/previous/v0.50.0/release.yaml
kubectl apply -f release.yaml
观察安装image拉取情况
kubectl get pods --namespace tekton-pipelines --watch
看到pod状态 running就是装好了
kubectl describe pod -n tekton-pipelines tekton-pipelines-controller-5b94d8b988-qjkjk
如果要删除,可以用命令
kubectl delete ns tekton-pipelines