Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kubernetes Meetup Tokyo #20 / KubeCon Recap: Te...
Search
jyoshise
June 18, 2019
Technology
250
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kubernetes Meetup Tokyo #20 / KubeCon Recap: Tekton
jyoshise
June 18, 2019
More Decks by jyoshise
See All by jyoshise
GitLab Duo Agent Platform + Local LLMサービングで幸せになりたい
jyoshise
0
800
米軍Platform One / Black Pearlに学ぶ極限環境DevSecOps
jyoshise
2
990
AIがコード書きすぎ問題にはAIで立ち向かえ
jyoshise
14
14k
Nutanix Kubernetes PlatformでLLMを動かす話
jyoshise
0
580
CNDT2023_Nutanix_jyoshise
jyoshise
0
650
クラウドネイティブインフラおじさんがNutanixに入社することになったので以下略
jyoshise
0
1.3k
これは分散KVS? NoSQL? NewSQL? 謎の HarperDBにせまる
jyoshise
0
650
全てがクラウドネイティブで良いのか。その謎を明らかにすべく我々はエンプラの奥地に向かった
jyoshise
8
6.1k
Kubeadmによるクラスタアップグレード・その光と闇
jyoshise
3
4.8k
Other Decks in Technology
See All in Technology
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
640
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
120
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
210
AIで実装は速くなった。なのにプロダクトは速くならない。職能の壁を越えて価値のフローを設計する
nwiizo
7
7.5k
目の前の楽しいが人生を変える - コミュニティの螺旋の歩き方と楽しむコツ / change your life
soudai
PRO
3
170
Claude Code本って、 読む必要あるの?
oikon48
1
170
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
150
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
2
380
Adaptive Warehouse を今すぐ導入すべき理由と迷ったときの判断基準
__allllllllez__
0
120
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
170
ペアプロの価値はコードを書くことだけじゃない
codmoninc
PRO
0
140
Screen Lens - 今見てる画面を翻訳する
komagata
0
140
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Typedesign – Prime Four
hannesfritz
42
3.2k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Become a Pro
speakerdeck
PRO
31
6.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Faster Mobile Websites
deanohume
310
32k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
The Language of Interfaces
destraynor
162
27k
30 Presentation Tips
portentint
PRO
1
390
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Transcript
Modern CI/CD with Tekton and Prow Automated via Jenkins X
Kubernetes Meetup #20 @jyoshise
Slide: https://static.sched.com/hosted_files/kccnceu19/ 98/Modern%20CI_CD%20with%20Tekton%20and %20Prow%20Automated%20via%20Jenkins%20X. pdf Video: https://www.youtube.com/watch?v=4EyTGYB7Gv A
whoami 3 • Junichi Yoshise / 吉瀬 淳一 • @jyoshise
• Chief Architect, Cloud Native Computing • Hewlett Packard Enterprise
4
私のふだんの仕事によくあるパターン DevOpsの見積もりをください。 コンテナの。 ( ゚Д゚)ざっくりしてんな!
「DevOpsがやりたい」とエンタープライズなお客さん(インフラ/運 用部門)が言ったとき • だいたい以下のようなことを意味している • インフラ構築の手間を減らしたい →コンテナで解決するんでしょ? • アプリケーションリリースの手間を減らしたい →CI/CDで解決するんでしょ?(開発ベンダーはCIやってるみたいだけど)
• クラウドネイティブっぽいことがやりたい →時代はクラウドネイティブなんでしょ? • というわけで、「クラウド Kubernetesネイティブな、コンテナアプ リケーションのCI/CD」の検討が始まる • やっぱ違うね、となることもしばしば
CI/CDのざっくりイメージ Code Build/UT IT Deploy Continuous Stage
レガシーなCI/CD さすがにGit (SVNとかまだ 見るけど) ビルドサーバー でMavenとか ステージング環 境でテスト実行 本番環境のアプ リケーション
サーバーにデプ ロイ Code Build/UT IT Deploy Continuous Stage ステージング環 境のアプリケー ションサーバー にデプロイ • Artifact • Trigger
Continuous Delivery Foundation • The Linux Foundationの下位組織(CNCFと横並び)として2019年3月に発足 • 夢はCI/CDのAPI標準化 •
https://cd.foundation
Continuous Delivery Summit Presentations: https://github.com/cdfoundation/presentat ions/tree/master/2019-summit-barcelona Video: https://www.youtube.com/watch?v=P7hFp bAJNVY&list=PL2KXbZ9- EY9RB8bVvmiSOqB39eNMs-fAe
CI/CDツールの生まれた時代 11 2011 2015 2018 2019 オンプレベアメタル/仮想マシン クラウド仮想マシン コンテナ Kubernetes
Kubernetes Nativeであることとは • あらゆるプロセスはコンテナとして実行できる • オブジェクトはDeclarative(宣言的)に記述される • 状態の変更は拡張可能なKubernetes APIを通じて行われる
レガシーなCI/CD さすがにGit (SVNとかまだ 見るけど) ビルドサーバー でMavenとか ステージング環 境でテスト実行 本番環境のアプ リケーション
サーバーにデプ ロイ Code Build/UT IT Deploy Continuous Stage ステージング環 境のアプリケー ションサーバー にデプロイ • Artifact • Trigger
Kubernetes NativeなCI/CD さすがにGit (SVNとかまだ 見るけど) ビルドサーバー でMavenとか ステージング環 境でテスト実行 本番環境のアプ
リケーション サーバーにデプ ロイ Code Build/UT IT Deploy Continuous Stage ステージング環 境のアプリケー ションサーバー にデプロイ • Artifact • Trigger • Source Repo • Dockerfile / Docker Image • Kubernetes Manifest / Template • 各タスクをKubernetes上で(それぞれのタスクに特化 したコンテナとして)実行 • スケール、ログ、認証などはKubernetesエコシステム を利用 • Eventing (webhook) • Kube API
突然ですがGitOpsについて • GitOps とは • Desired Stateを全てコードとして、Git Repositoryで管理する • Git
Repository上の状態と実環境の状態は常に一致させる(Continuous Deployment) •そのためのツールは必要 • 変更はGit Repositoryに対するPull Request → Merge • 実環境上でコマンドを叩くオペレーションは原則禁止 • 状態定義がDeclarativeにできることが前提 • Kubernetesに最適(みんな大好きYAML) 15
各レイヤーでのGitOpsが考えられる • アプリのGitOps • Pod, Service • いわゆるCI/CD • インフラのGitOps
• Ingress Controller, 共通の Operator/CRD(Rook, Prometheus)など • secretは除く • そもそもKubernetes自体 • CI/CDパイプラインのGitOps • Pipeline as Code 16
Kubernetes NativeなCI/CD さすがにGit (SVNとかまだ 見るけど) ビルドサーバー でMavenとか ステージング環 境でテスト実行 本番環境のアプ
リケーション サーバーにデプ ロイ Code Build/UT IT Deploy Continuous Stage ステージング環 境のアプリケー ションサーバー にデプロイ • Artifact • Trigger • 各タスクをKubernetes上で(それぞれのタスクに特化 したコンテナとして)実行 • スケール、ログ、認証などはKubernetesエコシステム を利用 パイプライン定義も Kubernetes Object • Source Repo • Dockerfile / Docker Image • Kubernetes Manifest / Template • Eventing (webhook) • Kube API
そこでTektonですよ • 出身はKnative: Kubernetes上でのPaaS/Serverlessプラットフォームを 実現するプロジェクト 18 Knative-build Knative-serving Knative-eventing Knative-build-
pipeline https://github.com/tektoncd
tektoncd/pipelineの実体 • Deployment: • controller • webhook 19 $ kubectl
apply -f https://storage.googleapis.com/tekton-releases/latest/release.yaml その他サブプロジェクト: • tektoncd/dashboard • ダッシュボード(Web UI) • tektoncd/cli • tkn(CLI) • tektoncd/catalog • Taskの見本帳 • CRD: • PipelineResource • Task • TaskRun • Pipeline • PipelineRun • ClusterTask
Example(簡単なPipeline) image build source Dockerfile Manifest template Deploy Tekton Manifests
GitHub Repo Pipeline DockerHub kaniko Manifest 加工 kubectl Kubernetes Pipeline Task PipelineResource Step
PipelineResource CRD image build source Dockerfile Manifest template Deploy Tekton
Manifests GitHub Repo Pipeline DockerHub kaniko Manifest 加工 kubectl Kubernetes Pipeline Task PipelineResource Step
PipelineResource CRD • TaskがInput/Outputとして使うリソースを 定義 • typeは現時点で以下の四つだけ • git :
Gitレポジトリ • image : コンテナイメージのレジストリ • cluster : Kubernetesクラスタ • storage : GCS 22 apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata: name: git-tektondemo spec: type: git params: - name: revision value: master - name: url value: https://github.com/jyoshise/tekton-demo- app.git
Task CRD image build source Dockerfile Manifest template Deploy Tekton
Manifests GitHub Repo Pipeline DockerHub kaniko Manifest 加工 kubectl Kubernetes Pipeline Task PipelineResource Step
Task CRD • 実行するタスクを定義 • spec.inputs / spec.outputs でタスクの入力/ 出力となるリソースの型を指定
• 実際にどのPipelineResourceを使うかは PipelineRun/TaskRunで実行時に指定する • spec.stepsはコンテナのspec • stepは複数指定可能。順番に実行される 24 apiVersion: tekton.dev/v1alpha1 kind: Task metadata: name: deploy-using-kubectl spec: inputs: resources: - name: source type: git - name: image type: image params: - name: path description: Path to the manifest to apply - name: yqArg description: Arg passed to yq - name: yamlPathToImage description: The path to the image to replace in the yaml manifest (arg to yq) steps: - name: replace-image image: mikefarah/yq command: ["yq"] args: - "w" - "-i" - "${inputs.params.yqArg}" - "${inputs.params.path}" - "${inputs.params.yamlPathToImage}" - "${inputs.resources.image.url}" - name: run-kubectl image: lachlanevenson/k8s-kubectl command: ["kubectl"] args: - "apply" - "-f" - "${inputs.params.path}"
Catalog • Taskの見本帳 • Knative-buildプロジェク トもいずれこちらに統 合されるかも 25
Pipeline CRD image build source Dockerfile Manifest template Deploy Tekton
Manifests GitHub Repo Pipeline DockerHub kaniko Manifest 加工 kubectl Kubernetes Pipeline Task PipelineResource Step
Pipeline CRD • パイプラインを定義 • 複数のTaskを並べ、Taskごとにパラメー ターとinputs/outputsを宣言する • inputとして前のTaskのoutputを指定する ことで依存関係が指定できる
27 apiVersion: tekton.dev/v1alpha1 kind: Pipeline metadata: name: demo-pipeline spec: resources: - name: source-repo type: git - name: web-image type: image tasks: - name: build-web taskRef: name: build-docker-image-from-git-source params: ... - name: deploy-web taskRef: name: deploy-using-kubectl resources: inputs: - name: source resource: source-repo - name: image resource: web-image from: - build-web params: - name: path value: /workspace/source/manifests/deployment.yaml - name: yqArg value: "-d1" - name: yamlPathToImage value: "spec.template.spec.containers[0].image"
PipelineRun/TaskRun CRD • PipelineやTaskを起動するためには、 PipelineRun/TaskRunのオブジェクトを生 成する必要がある • Event Triggeringがまだ実装されていないため •
権限を要するTaskを実行するには、ここ でserviceAccountを指定する • PipelineResourceはここで指定する 28 apiVersion: tekton.dev/v1alpha1 kind: PipelineRun metadata: name: demo-pipeline-run-1 spec: serviceAccount: build-bot pipelineRef: name: demo-pipeline resources: - name: source-repo resourceRef: name: git-tektondemo - name: web-image resourceRef: name: image-tektondemo
いちおうDashboardもあります 29
Demo 30
Tektonに今のところ足りてないモノ • Event Triggering • Log Persistence • SCM support
• Pipeline Resource / Taskの拡張性 31
Tektonの使い方いろいろ 32 https://www.slideshare.net/ChristieWilson3/tekton-showcase-cdf-summit-kubecon-barcelona-2019
Jenkins X + Prow + Tekton • Prow https://github.com/kubernetes/test-infra/tree/master/prow •
Kubernetes自体のCI/CDのために開発された • 各種プラグインによりGitHub上でChatOpsを実現する • Jenkins X Pipelines (Tekton Mode) https://jenkins-x.io/getting-started/next-gen- pipeline/ • まだearly work(隠しモード的な)。たぶんGKEでしか動かない • PipelineはJenkinsfileではなくjenkins-x.yamlで記述される→Tekton Pipelineに内部で変換される • Pipelineの実行はTektonのPipeline Controllerが行う。Jenkins Serverがいらない • デモは動画見てください! 33
まとめ 34
まとめ • Kubernetesを拡張してなんでも載せていく方向性としては、Tektonは筋が いい、なぜなら • Kubernetesの上で実行するCI/CDパイプラインをKubernetes Nativeに記述できる • それによってCI/CDパイプラインも宣言的に管理できる •
とはいえ現時点では単体でCI/CDツールとして完結するものではない • Jenkins Xのように、他ツールがTektonを利用する動きはこれから出てくる のでは • なのでTekton流のPipeline as Codeに親しんでおいて損はない 35
Thank You 36