Cloud-native pipeline with Tekton

Cloud-native pipeline with Tekton

320f3b558c773592bba16c976d1b28d1?s=128

Alex Khaerov

January 27, 2020
Tweet

Transcript

  1. Sample App Web Service 1 Web Service 2 http request

    http response http request http response
  2. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  3. None
  4. • Kubernetes Style Resources ⇔ Tekton Custom Resources • Declaring

    CI/CD Pipelines ⇔ Tekton Controllers Manages State
  5. “Kubernetes resource model is coming to an API near you!”

    - Kubernetes-style APIs of the Future, Daniel Smith KubeCon CloudNativeCon Europe, May 2018
  6. Kubernetes Resource Model API Operation State Handles

  7. API Operations Resources • Pods • Deployments • Service •

    Node • ... Verbs • Get • List • Create • Update • Delete • Patch • Watch
  8. • Pods • Deployments • Service • Node • …

    • Custom Resources • Get • List • Create • Update • Delete • Patch • Watch API Operations Resources Verbs
  9. State Controllers • Split System State into small pieces •

    Separate Controllers manage each piece Resource State Controller Events
  10. • Split System State into small pieces • Separate Controllers

    manage each piece Resource State Controller Events Yes!, we can add custom controllers :) State Controllers
  11. None
  12. None
  13. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  14. Tekton Pipeline Custom Resources • Task • PipelineResource • Pipeline

    • TaskRun • PipelineRun
  15. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  16. Task • Defines the work that needs to be executed

    • Every task runs as a Pod • Contains multiple steps
  17. Steps (in a Task) • Series of commands • Sequentially

    executed by the task. • Each step in a task runs as a container Task step step step
  18. Task Input and Outputs • Input • PipelineResources • Parameters

    • Output • PipelineResources
  19. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  20. PipelineResource • Predefined input/output • System defined resource types ready

    to use • Decoupled and reusable • Commonly used PipelineResource types: image, git
  21. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  22. Pipeline • Defines list of Tasks to execute • Expresses

    Task order (graph) • Links Tasks inputs and outputs Pipeline Task Task Task Task Task
  23. Pipeline

  24. TaskRun • Instance of a defined Task • Binds the

    inputs/outputs to a Task • Sets values to the parameters • Executes Task steps
  25. TaskRun

  26. TaskRun

  27. TaskRun

  28. TaskRun

  29. PipelineRun • Instance of a defined Pipeline • Binds inputs/outputs

    to a Pipeline • Execute the Tasks in the Pipeline • Create the TaskRuns for each Task and collect the results
  30. CI/CD with Tekton Pipeline on Kubernetes Demo

  31. Sample App Web Service 1 Web Service 2 http request

    http response http request http response
  32. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  33. Build Task Pull source code (Step) Build container Image (Step)

    Push container image (Step) (Task) source code (PipelineResource) container image (PipelineResource) execution order inputs
  34. Deployment Task Update Deployment manifest (Step) Create Deployment (Step) (Task)

    container image (PipelineResource) Functional web services execution order inputs
  35. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  36. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  37. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  38. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  39. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  40. tkn (Tekton CLI) Available Commands • task : Manage tasks

    • taskrun : Manage taskruns • pipeline : Manage pipelines • pipelinerun : Manage pipelineruns • completion : Prints shell completion scripts • help : Help about any command • version : Prints version information
  41. tkn task Available Sub-Commands • list : Lists tasks in

    a namespace tkn taskrun Available Sub-Commands • list : Lists taskruns in a namespace • logs : Displays taskrun logs
  42. tkn pipeline Available Sub-Commands • describe : Describes a pipeline

    in a namespace • list : Lists pipelines in a namespace • start : Start pipelines by creating a pipelinerun in a namespace tkn pipelinerun Available Sub-Commands • describe : Describe a pipelinerun in a namespace • list : Lists pipelineruns in a namespace • logs : Display pipelinerun logs