3.3.1
Getting started
Getting started with Tasks
cluster check
//To install the latest version of Tekton Pipelines, use kubectl
# kubectl cluster-info
Kubernetes control plane is running at https://10.1.6.104:6443
CoreDNS is running at https://10.1.6.104:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Install Tekton Pipelines
kubectl apply --filename \
https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
// 需要准备如下几个镜像
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/controller:v0.52.1
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/events:v0.52.1
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/webhook:v0.52.1
gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/resolvers:v0.52.1
// Google Container Registry Mirror(Google Container Registry镜像加速)
https://github.com/anjia0532/gcr.io_mirror
# cat /usr/local/bin/pull-k8s-image.sh
#!/bin/sh
k8s_img=$1
mirror_img=$(echo ${k8s_img}|
sed 's/quay\.io/anjia0532\/quay/g;s/ghcr\.io/anjia0532\/ghcr/g;s/registry\.k8s\.io/anjia0532\/google-containers/g;s/k8s\.gcr\.io/anjia0532\/google-containers/g;s/gcr\.io/anjia0532/g;s/\//\./g;s/ /\n/g;s/anjia0532\./anjia0532\//g' |
uniq)
if [ -x "$(command -v docker)" ]; then
sudo docker pull ${mirror_img}
sudo docker tag ${mirror_img} ${k8s_img}
exit 0
fi
if [ -x "$(command -v ctr)" ]; then
sudo ctr -n k8s.io image pull docker.io/${mirror_img}
sudo ctr -n k8s.io image tag docker.io/${mirror_img} ${k8s_img}
exit 0
fi
echo "command not found:docker or ctr"
# pull-k8s-image.sh gcr.io/tekton-releases/github.com/tektoncd/triggers/cmd/interceptors:v0.25.0
# docker image ls
anjia0532/tekton-releases.github.com.tektoncd.triggers.cmd.interceptors v0.25.0 dc7e340d8c2d N/A 71.2MB
# docker tag anjia0532/tekton-releases.github.com.tektoncd.triggers.cmd.interceptors:v0.25.0 gcr.io/tekton-releases/github.com/tektoncd/triggers/cmd/interceptors:v0.25.0
Tekton-yaml
//Monitor the installation
kubectl get pods --namespace tekton-pipelines --watch
# kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
clusterpedia-system clusterpedia-apiserver-5bd88d6488-nw8p5 1/1 Running 2 (21h ago) 5d
clusterpedia-system clusterpedia-clustersynchro-manager-57f7b7bd4-b9pxt 1/1 Running 2 (21h ago) 5d
clusterpedia-system clusterpedia-controller-manager-846c98df9d-v5v8m 1/1 Running 1 (21h ago) 5d1h
clusterpedia-system clusterpedia-internalstorage-mysql-7f675744f9-bsqqc 1/1 Running 1 (21h ago) 5d1h
default hello-task-run-pod 0/1 Completed 0 19m
kube-system calico-kube-controllers-79568db7f8-zxx7p 1/1 Running 1 (21h ago) 6d3h
kube-system calico-node-gvdd9 1/1 Running 1 (21h ago) 6d3h
kube-system coredns-5bbd96d687-5vcst 1/1 Running 1 (21h ago) 6d4h
kube-system coredns-5bbd96d687-xvhw5 1/1 Running 1 (21h ago) 6d4h
kube-system etcd-master 1/1 Running 32 (21h ago) 6d4h
kube-system kube-apiserver-master 1/1 Running 33 (21h ago) 6d4h
kube-system kube-controller-manager-master 1/1 Running 32 (21h ago) 6d4h
kube-system kube-proxy-qctcj 1/1 Running 1 (21h ago) 6d4h
kube-system kube-scheduler-master 1/1 Running 32 (21h ago) 6d4h
tekton-pipelines-resolvers tekton-pipelines-remote-resolvers-7cc8f8ccd7-9lrfq 1/1 Running 0 52m
tekton-pipelines tekton-events-controller-7d5d647679-jfjmc 1/1 Running 0 48m
tekton-pipelines tekton-pipelines-controller-85d696445-jwr49 1/1 Running 0 52m
tekton-pipelines tekton-pipelines-webhook-7f9b55c65-9cmj8 1/1 Running 0 52m
velero minio-6d4696f57f-g64q9 1/1 Running 1 (21h ago) 6d
velero restic-k9sw9 1/1 Running 1 (21h ago) 6d
velero velero-55796c7c76-v9nfg 1/1 Running 1 (21h ago) 6d
// hello-world.yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
echo "Hello World"
// kubectl apply --filename hello-world.yaml
// hello-world-run.yaml
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: hello-task-run
spec:
taskRef:
name: hello
kubectl apply --filename hello-world-run.yaml
kubectl get taskrun hello-task-run
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
hello-task-run True Succeeded 19m 76s
kubectl logs --selector=tekton.dev/taskRun=hello-task-run
Defaulted container "step-echo" out of: step-echo, prepare (init), place-scripts (init)
Hello World
// 安装命令行工具tkn
// 安装dashboard
Create and run a Pipeline