k8s原生CI/CD
目录
狐狸、小狗和星际章鱼?
Tekton
基本概念
- A step is an operation in a CI/CD workflow –> Tekton performs each step with a container image you provide.
- A task is a collection of steps in order –> Tekton runs a task in the form of a Kubernetes pod, where each step becomes a running container in the pod. This design allows you to set up a shared environment for a number of related steps.
- A pipeline is a collection of tasks in order.
- TaskRuns and pipelineRuns connect resources with tasks and pipelines. A run must include the actual addresses of resources, such as the URLs of repositories, its task or pipeline needs. This design allows developers to reuse tasks and pipelines for different inputs and outputs.
Tekton如何保证Pod内的容器执行顺序?
Tekton通过注入一个叫entrypoint的二进制文件来确保容器的执行顺序,对应的也就是Step的执行顺序。
How Tekton works
Tekton Pipelines tracks the state of your pipeline using Kubernetes Annotations. These annotations are projected inside each step container in the form of files with the Kubernetes Downward API. The entrypoint binary watches the projected files closely, and will only start the provided command if a specific annotation appears as files. For example, when you ask Tekton to run two steps consecutively in a task, the entrypoint binary injected into the second step container will wait idly until the annotations report that the first step container has successfully completed.
Kubernetes Downward API能将Pod的注解投影至Container的卷中,entrypoint就可以通过文件的状态和内容监控前一个Container执行情况。