最近对tekton, spinnaker, argo cd想系统了解一下。于是,开始有了这一个系列。一切都有套路,先从官网文档开始。
文档
https://tekton.dev/docs/getting-started/
一,tkn下载安装
这个tkn还是有点用的,比kubectl要方便快捷,功能类似,就好像istioctl这些工具一样。林子作大了,都要有自己的套装。
https://github.com/tektoncd/cli/releases
下载最新的rpm直接安装即可。
rpm -ivh tektoncd-cli-0.15.0_Linux-64bit.rpm
二,下载release.yaml
这是关键文件,下载地址:
https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
但这个文件,不能直接用,要修改里面的几个镜像的地址,因为都是gcr仓库,你懂。
主要修改deployment对象。
controller里的image,不少。
containers:
- name: tekton-pipelines-controller
image: aguncn/tektoncd-controller:v0.20.1
args: [
# Version, to be replace at release time
"-version", "v0.20.1",
# These images are built on-demand by `ko resolve` and are replaced
# by image references by digest.
"-kubeconfig-writer-image", "aguncn/tektoncd-kubeconfigwriter:v0.20.1", "-git-image", "aguncn/tektoncd-git-init:v0.20.1", "-entrypoint-image", "aguncn/tektoncd-entrypoint:v0.20.1", "-nop-image", "aguncn/tektoncd-nop:v0.20.1", "-imagedigest-exporter-image", "aguncn/tektoncd-imagedigestexporter:v0.20.1", "-pr-image", "aguncn/tektoncd-pullrequest-init:v0.20.1", "-build-gcs-fetcher-image", "aguncn/tektoncd-gcs-fetcher:v0.20.1",
# This is gcr.io/google.com/cloudsdktool/cloud-sdk:302.0.0-slim
"-gsutil-image", "aguncn/cloudsdktool-cloud-sdk",
# The shell image must be root in order to create directories and copy files to PVCs.
# gcr.io/distroless/base:debug as of November 15, 2020
# image shall not contains tag, so it will be supported on a runtime like cri-o
"-shell-image", "aguncn/distroless-base"]
webhook的一个:
containers:
- name: webhook
# This is the Go import path for the binary that is containerized
# and substituted here.
image: aguncn/tektoncd-webhook:v0.20.1
# Resource request required for autoscaler to take any action for a metric
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 500m
memory: 500Mi
至于这些aguncn/的镜像如何得到,看图呀~~
github
2021-02-03 22_01_56-悬浮球.png
dockerhub
2021-02-03 22_02_12-悬浮球.png
三,将修改过的yaml应用于k8s
kubectl apply -f release.yaml
如果没问题,两个pod都会running起来的。
四,测试task和taskrun
task-hello.yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello-tekton
spec:
steps:
- name: hello-tekton
image: rancher/library-busybox:1.31.1
command:
- echo
args:
- "Hello Tekton!"
将这个yaml apply -f 应用于集群,之后调用tkn命令启动此任务,根据提示看输出。
[root@localhost tekton]# tkn task start hello-tekton
TaskRun started: hello-tekton-run-4gf4c
In order to track the TaskRun progress run:
tkn taskrun logs hello-tekton-run-4gf4c -f -n default
[root@localhost tekton]# tkn taskrun logs hello-tekton-run-4gf4c -f -n default
[hello-tekton] Hello Tekton!
就这样吧,今天先休息。
2021-02-03 22_06_32-214 - root@localhost_~_tekton - Xshell 6 (Free for Home_School).png
网友评论