Please enable Javascript to view the contents

Go-Tekton使用-使用示例以及遇坑小记

 ·  ☕ 1 分钟

重要

打算依托Tekton,作为工作流工具,将以下业务场景用task实现:

  1. 镜像部署
  2. 源码构建+镜像部署
  3. 源码文件上传hdfs
  4. 微服务依赖关系

环境说明

k8s集群:

安装

Tekton安装,通过官方GitHub仓库中的release.yaml文件部署服务。

1
kubectl apply -f https://github.com/tektoncd/pipeline/releases/download/v0.16./release.yaml

使用

需要检查这几项, workspace

Reference

官方文档入口-select-version

nuctl

nuctl 是nuclio的客户端, nuctl使用时需要访问docker-daemon,

1
2
3
4
$ nuctl get project --verbose
20.10.20 16:53:48.316            nuctl.platform (D) Using kubeconfig {"kubeconfigPath": "/home/hex/.kube/config"}
20.10.20 16:53:48.324 tl.platform.docker.runner (D) Executing {"command": "docker version"}
20.10.20 16:53:48.388 tl.platform.docker.runner (D) Command executed successfully {"output": "Client: Docker Engine - Community\n Version:           19.03.4\n API version:       1.40\n Go version:        go1.12.10\n Git commit:        9013bf583a\n Built:             Fri Oct 18 15:54:09 2019\n OS/Arch:           linux/amd64\n Experimental:      false\n\nServer: Docker Engine - Community\n Engine:\n  Version:          19.03.4\n  API version:      1.40 (minimum version 1.12)\n  Go version:       go1.12.10\n  Git commit:       9013bf583a\n  Built:            Fri Oct 18 15:52:40 2019\n  OS/Arch:          linux/amd64\n  Experimental:     false\n containerd:\n  Version:          1.2.10\n  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339\n runc:\n  Version:          1.0.0-rc8+dev\n  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657\n docker-init:\n  Version:          0.18.0\n  GitCommit:        fec3683\n", "stderr": "", "exitCode": 0}

所以需要创建docker-in-docker的服务
task docker-in-docker
dind issue

构建镜像(kaniko)

task kaniko

task之间传递数据(通过 result 配置)

传出result
传出result – task级别
传出result – pipe级别

传入result – task级别

使用when做任务编排

任务编排 – when

使用runAfter做任务编排

任务编排 – runAfter

workspace

工作空间使用

auth

Authorization at RunTime

分享

Hex
作者
Hex
CloudNative Developer

目录