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
Skaffoldを使ってみた
Search
hhiroshell
April 28, 2018
Technology
0
2.5k
Skaffoldを使ってみた
「あつまれ! CI/CDツール大集合! - cndjp第5回」での発表資料です。Skaffoldの役割や使い方をまとめました。
hhiroshell
April 28, 2018
Tweet
Share
More Decks by hhiroshell
See All by hhiroshell
LINEヤフーにおける超大規模プラットフォーム実現への挑戦と学び / Challenges and Lessons in Building an Ultra-Large-Scale Platform at LY Corporation
hhiroshell
3
1.4k
Architecting Kubernetes-Based Internal Developer Platforms: Essential Patterns and Practices
hhiroshell
0
120
Discover Your Tailored Platform Strategy with Real-World Practice
hhiroshell
1
220
Kubernetesでアプリの安定稼働と高頻度のアップデートを両立するためのプラクティス / Best Practices for Applications on Kubernetesto Achieve Both Frequent Updates and Stability
hhiroshell
11
3.9k
Platform EngineeringにおけるKubernetesの活用法とLINEヤフーにおける事例のご紹介 / Platform Engineering and Kubernetes Findy Lunch LT Edition
hhiroshell
7
2k
大規模Webアプリケーションプラットフォームを開発して軌道に乗るまでにやったこと / How to Put Platforms on Track
hhiroshell
2
2.5k
Kubernetesとカスタムコントローラーを活用したプラットフォーム開発・運用の勘所 / Platform Engineering and Kubernetes
hhiroshell
1
1.3k
Best Practices for Applications on Kubernetesto Achieve Both Frequent Updates and Stability
hhiroshell
3
700
Cloud Native Developers JP (cndjp) のご紹介 / about cndjp
hhiroshell
0
230
Other Decks in Technology
See All in Technology
Ruby on Railsで持続可能な開発を行うために取り組んでいること
am1157154
3
150
Potential EM 制度を始めた理由、そして2年後にやめた理由 - EMConf JP 2025
hoyo
2
2.6k
偏光画像処理ライブラリを作った話
elerac
1
170
技術スタックだけじゃない、業務ドメイン知識のオンボーディングも同じくらいの量が必要な話
niftycorp
PRO
0
100
Amazon Aurora のバージョンアップ手法について
smt7174
2
150
短縮URLをお手軽に導入しよう
nakasho
0
150
1行のコードから社会課題の解決へ: EMの探究、事業・技術・組織を紡ぐ実践知 / EM Conf 2025
9ma3r
11
3.8k
30→150人のエンジニア組織拡大に伴うアジャイル文化を醸成する役割と取り組みの変化
nagata03
0
180
AWSではじめる Web APIテスト実践ガイド / A practical guide to testing Web APIs on AWS
yokawasa
8
690
Perlの生きのこり - エンジニアがこの先生きのこるためのカンファレンス2025
kfly8
2
270
OPENLOGI Company Profile
hr01
0
60k
Visualize, Visualize, Visualize and rclone
tomoaki0705
9
83k
Featured
See All Featured
Docker and Python
trallard
44
3.3k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
Mobile First: as difficult as doing things right
swwweet
223
9.4k
Designing for humans not robots
tammielis
250
25k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
How to Think Like a Performance Engineer
csswizardry
22
1.4k
Code Reviewing Like a Champion
maltzj
521
39k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Unsuck your backbone
ammeep
669
57k
Scaling GitHub
holman
459
140k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
Transcript
Cloud Native Developers JP Skaffoldを使ってみた @hhiroshell 1
Cloud Native Developers JP Skaffoldとは • Kubernetesに乗せるアプリケーションの開発作業を省力化してくれ るコマンドラインツール – https://github.com/GoogleContainerTools/skaffold
• Googleのエンジニアを中心に開発されているOSS – Apache License 2.0 • 2018年3月発表。最新バージョンはv0.5.0(2018/04/25現在) • 類似のツールに、Draft、keelというものがあるらしい 2
Cloud Native Developers JP 3 動作確認するだけでも結構手間がかかる…。 Kubernetesにのせるアプリを開発するときの作業 1 アプリの コードを編集
2 コンテナ イメージの Build 3 コンテナ レジストリへ Push 4 Kubernetesへ Deploy くりかえし
Cloud Native Developers JP 4 動作確認するだけでも結構手間がかかる…。 Kubernetesにのせるアプリを開発するときの作業 1 アプリの コードを編集
2 コンテナ イメージの Build 3 コンテナ レジストリへ Push 4 Kubernetesへ Deploy くりかえし K8sであるが故に必要な作業(面倒くさい)
Cloud Native Developers JP 2 Build 3 Push 4 Deploy
Skaffold Pipeline • Build, Push, Deployの各フェーズで、必要なコマンドを順次自動実 行してくれるイメージ • らくちん! 5 面倒なBuild, Push, DeployをSkaffoldで自動化 > docker build > docker push > kubectl apply
Cloud Native Developers JP 2 Build 3 Push 4 Deploy
Skaffoldのプラグインアーキテクチャ • dockerコマンドとkubectlを自動化する使い方 6 各フェーズの実態をプラグイン的に変更できる > docker build > docker push > kubectl apply Google Container Builder Google Container Registry > helm install
Cloud Native Developers JP > docker build > docker push
> kubectl apply Google Container Builder Google Container Registry > helm install Skaffoldのプラグインアーキテクチャ • GKEとhelmの場合 7 各フェーズの実態をプラグイン的に変更できる 2 Build 3 Push 4 Deploy
Cloud Native Developers JP 2 Build 3 Push 4 Deploy
Skaffoldのプラグインアーキテクチャ • PushなしでKubernetesにデプロイ。ローカル開発で便利 8 各フェーズの実態をプラグイン的に変更できる > docker build > docker push > kubectl apply Google Container Builder Google Container Registry > helm install
Cloud Native Developers JP Demo(基本編) ローカル開発で使う 9
Cloud Native Developers JP skaffold dev と skaffold run •
> skaffold dev – コンソールのフォアグラウンドに常駐 – コンテナイメージの依存ファイルに対する変更を検知して、Skaffold Pipeline を自動で実行してくれる – 開発中のコンテナの標準出力を自動でtailする • > skaffold run – – Skaffold Pipelineを一度だけ実行して終わる – CI/CDの中で使うときや、アプリ開発が一段落した後のサニティチェックと して 10 ローカル開発ではdevの方を積極的に活用しよう
Cloud Native Developers JP skaffold.yaml ① imageNameでイメージ名を指 定(タグは自動で付与) ② デフォルトではworkspace直下
のDockerfileをビルド ③ skipPosh: trueによりコンテナ レジストリへのプッシュ不要で 直接k8sにデプロイ ④ デプロイ時は、manifestsに指 定したファイルを kubectl apply してくれる 11 Pipelineの定義ファイル 1 apiVersion: skaffold/v1alpha2 2 kind: Config 3 build: 4 artifacts: 5 - imageName: gcr.io/k8s-skaffold/skaffold-example 6 workspace: . 7 local: 8 skipPush: true 9 deploy: 10 kubectl: 11 manifests: 12 - k8s-* 13 profiles: 14 - name: gcb 15 build: 16 googleCloudBuild: 17 projectId: k8s-skaffold … ① … ② … ③ … ④
Cloud Native Developers JP skaffold.yaml ⑤ profileによって複数の Pipelineを切替えられる – この例ではGoogle
Container Builderでk8s-skaffoldプロジェ クトをビルド – > scaffold run -p gcb 12 Pipelineの定義ファイル 1 apiVersion: skaffold/v1alpha2 2 kind: Config 3 build: 4 artifacts: 5 - imageName: gcr.io/k8s-skaffold/skaffold-example 6 workspace: . 7 local: 8 skipPush: true 9 deploy: 10 kubectl: 11 manifests: 12 - k8s-* 13 profiles: 14 - name: gcb 15 build: 16 googleCloudBuild: 17 projectId: k8s-skaffold … ⑤
Cloud Native Developers JP Demo(やってみた編) Jnekinsと組合せて使う 13
Cloud Native Developers JP 使ってみた感想 • 安定しているとは言えない – かなり頻繁にアップデートされている(発表から2ヶ月で v0.1.0
→ v0.5.0) – 約1週間使い込んだところ、バグと思しき挙動に2つ遭遇 – v0.xだからか、マイナーバージョンアップでも仕様が変わることがある • とはいえ一度動かしきればメリットは大きい – チーム開発に影響しない範囲で、個人として導入するには賛成 – コーディングが実に捗る • 他のツールも試してみたい – Draft、keel – 参考: 「SkaffoldとDraftを比べてみた」https://qiita.com/watawuwu/items/7f5e287c91e5eab30419 14 ローカル開発で積極的に使っていきたい
Cloud Native Developers JP Fin. 15