tekla可以在mac上运行吗(tekton的最新版本安装教程和发布镜像的示例)

发布日期:2024-12-22 02:07:41     作者:你一世傲骨     手机:https://m.xinb2b.cn/life/bqg324427.html     违规举报

Tekton 一个基于K8S的云原生的通用的 CI/CD 工具,最近闲来无事研究了一下,先说一下安装流程,由于使用的镜像都部署在国外服务器,按照官方的教程是没法正常安装的,所以我事先把使用的镜像都同步到阿里云的镜像服务器了。

使用的前提是已经有一个可用的k8s集群了,可以执行下面的脚本,事先把相关的镜像下载下来。

ocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:pullrequest-initdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:git-initdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:entrypointdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:imagedigestexporterdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:kubeconfigwriterdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:nopdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:webhookdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:controllerdocker pull registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:dashboarddocker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:pullrequest-init gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/pullrequest-init:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:entrypoint gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/entrypoint:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:imagedigestexporter gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/imagedigestexporter:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:git-init gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:kubeconfigwriter gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/kubeconfigwriter:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:nop gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:webhook gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:controller gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.27.2docker tag registry.cn-hangzhou.aliyuncs.com/dushougudu/docker.dushougudu:dashboard gcr.io/tekton-releases/github.com/tektoncd/dashboard/cmd/dashboard:v0.20.0

请务必使用v0.27.2版本的安装yaml 文件,直接执行下面的安装命令,正常情况下就可以安装完成了。

kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.27.2/release.yaml


安装完成可以看到tekton运行的pod

然后我们再安装一个tekton的dashbord,大家也可以把文件下载下来,修改一下service的端口映射,可以直接通过ip访问dashbord

kubectl apply -f https://storage.googleapis.com/tekton-releases/dashboard/previous/v0.20.0/tekton-dashboard-release.yaml


增加红色部分的配置

这样就可以直接通过http://nodeip:30097访问dashbord了


下面再给出一个镜像打包发布的完整流程配置,整个流程是从git仓库下载代码,通过kaniko执行相应的dockerfile进行程序的打包,然后把打包好的镜像发布到私有的harbor镜像仓库

kind: ConfigMapapiVersion: v1metadata: name: docker-configdata: config.json: | {"auths":{"harbor地址":{"username":"xxx","password":"xxxxx"}}}---apiVersion: tekton.dev/v1alpha1kind: PipelineResourcemetadata: name: cnych-resspec: type: git params: - name: url value: https://github.com/cnych/tekton-demo - name: revision value: master---apiVersion: tekton.dev/v1beta1kind: Taskmetadata: name: build-and-pushspec: resources: inputs: - name: repo type: git steps: - name: build-and-push image: daocloud.io/gcr-mirror/kaniko-project-executor:latest args: [ "--dockerfile=/workspace/Dockerfile", "--context=dir://workspace/repo", "--insecure=true", "--cache=false", "--skip-tls-verify=true", "--destination=harbor地址/项目/tekton-test:v1" ] volumeMounts: - name: docker-config mountPath: /kaniko/.docker volumes: - name: docker-config configMap: name: docker-config---apiVersion: tekton.dev/v1beta1kind: TaskRunmetadata: name: build-push-runspec: taskRef: name: build-and-push resources: inputs: - name: repo resourceRef: name: cnych-res

上面只需要把harbor的相关地址、用户名和密码配置成自己的就可以了,其他的不需要作修改。这样正常执行完成后,就能看到执行状态是成功的绿色状态。


 
 
本文地址:https://xinb2b.cn/life/bqg324427.html,转载请注明出处。

推荐图文
推荐生活知识
网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  违规举报  |  蜀ICP备18010318号-4  |  百度地图  | 
Processed in 0.135 second(s), 1 queries, Memory 2.42 M