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
Argo CD 実践ガイド #k8sjp / Argo CD Practice Guide
Search
d-kuro
July 25, 2019
Technology
13
8.3k
Argo CD 実践ガイド #k8sjp / Argo CD Practice Guide
Kubernetes Meetup Tokyo #21 - Cloud Native CI/CD で発表した資料です
https://k8sjp.connpass.com/event/138375/
d-kuro
July 25, 2019
Tweet
Share
More Decks by d-kuro
See All by d-kuro
kube-state-metrics Sharding
daikurosawa
0
310
Helm Chart を Unit Test する / Unit Testing Helm Chart
daikurosawa
0
2k
Understanding CPU throttling in Kubernetes to improve application performance #k8sjp
daikurosawa
12
15k
Leader Election in Kubernetes #k8sjp
daikurosawa
5
10k
図で理解する Descheduler #k8sjp #ymju / Introduction to Descheduler
daikurosawa
12
23k
Kubernetes のソースコードとの付き合い方 #gounco / Kubernetes source code reading
daikurosawa
24
5k
GolangCI を使ってコードの品質を保ちながら快適な Golang 生活を送る話 #gounco / GolangCI
daikurosawa
4
5.8k
Introduction gRPC
daikurosawa
1
250
Go Cloud を触ってみる / gopher-dojo-lt
daikurosawa
2
2.1k
Other Decks in Technology
See All in Technology
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
0
180
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
アップデート紹介:AWS Data Transfer Terminal
stknohg
PRO
0
180
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
25
11k
5分でわかるDuckDB
chanyou0311
10
3.2k
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
UI State設計とテスト方針
rmakiyama
2
440
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
520
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Adopting Sorbet at Scale
ufuk
73
9.1k
Code Review Best Practice
trishagee
65
17k
4 Signs Your Business is Dying
shpigford
181
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
97
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Transcript
19/07/25 Kubernetes Meetup Tokyo #21 - Cloud Native CI/CD @ponde_m
Argo CD ࣮ફΨΠυ
ࠓճͷΠϕϯτϖʔδ
͜Εʹωλ͔ͿΓ͠ͳ͍Α͏ͳ ر "SHP$%ͷࡉ͔͍Λ͍͖ͯ͠·͢ ࠓճͷΠϕϯτϖʔδ
@ponde_m Dai Kurosawa SRE
͓͞Β͍: Argo CD ͱ • Pull ܕͷ CD • GitOps
ʹ͏ • ͍͍ײ͡ͷ UI
ࠓ͢͜ͱ • Argo CD ͷ CRD ʹ͍ͭͯ • Argo CD
ͷ RBAC ʹ͍ͭͯ • Argo CD ͷ Sync ઓུʹ͍ͭͯ
ࠓ͢͜ͱ • Argo CD ͷ CRD ʹ͍ͭͯ • Argo CD
ͷ RBAC ʹ͍ͭͯ • Argo CD ͷ Sync ઓུʹ͍ͭͯ ͕࣌ؒΓͳ͔ͬͨͷͰ εΩοϓ͠·͢ (ࢿྉͦͷ··Ξοϓ͠·͢)
Argo CDͷ CRD
Argo CD ͷ CRD • 2ͭͷ CRD ͕͋Δ • Application
• AppProject
Argo CD ͷ CRD Application Application Application AppProject
Application • Argo CD ʹ͓͚Δ σϓϩΠͷઃఆ • ݱ࣮ੈքͷ ΞϓϦέʔγϣϯͱಉ͡୯Ґ (ෳͷ
Object ͷू߹)
Application Git Repository Revision Path Λࢦఆͯͦ͜͠ʹ͋Δ manifest ΛσϓϩΠ͢Δ
Application λʔήοτͱͳΔ Ϋϥελͱ namespace
Automated Sync • syncPolicy Λ ໌ࣔతʹࢦఆ͠ͳ͍ͱ ࣗಈͰಉظͯ͘͠Εͳ͍ͷͰҙ • prune: true
Λࢦఆ͠ͳ͍߹ Ϧιʔεͷ Pruning ߦΘΕͳ͍
Tools • αϙʔτ͍ͯ͠Δ apply ํ๏ • kustomize • Helm charts
• Ksonnet • YAML/JSON/Jsonnet manifest ͷσΟϨΫτϦ • ϓϥάΠϯ (ࣗ࡞όΠφϦ͑Δ)
Application of Applications • Application Ͱ Application Λཧ͢Δ
Application of Applications • kustomize ͷྫ: root.yaml
Application of Applications • kustomize ͷྫ: root.yaml ͜͜ͷ path ࢦఆͰ
Application of Applications • kustomize ͷྫ: root.yaml ͜͜ͷ path ࢦఆͰ
application-of-applications σΟϨΫτϦͷ kustomization.yaml ͕ࢀর͞ΕΔ
Application of Applications • kustomize ͷྫ: kustomization.yaml
Application of Applications • kustomize ͷྫ: kustomization.yaml kustomize ͷ resources
Ͱ root ʹඥͮ͘ Application Λࢦఆ͢Δ
Application of Applications • kustomize ͷྫ: root ʹͳΔ Application Λ
apply ͢Δ
Application of Applications • kustomize ͷྫ:
Application of Applications • kustomize ͷྫ: root ʹͳΔ Application Λ
apply ͚ͨͩ͠Ͱ root ʹඥͮ͘ Application উखʹద༻͞ΕΔ
Application of Applications UI ͔Β͜ͷΑ͏ͳײ͡Ͱ දࣔ͞ΕΔ
Application of Applications • kustomize ͷྫ: ͜ΕΒͷ Application GitOps
Ͱࣗಈతʹ Sync ͞ΕΔ (feature ϒϥϯνͷ manifest Λ ద༻͍ͨ͠Έ͍ͨͳঢ়گͷ࣌ʹָ)
Application of Applications revision Λॻ͖͑ͨ Pull Request Λ merge ͢Δͱ
feature ϒϥϯνͷ manifest ΛࢀরͰ͖Δ
AppProject • Application ͷ ཧతͳάϧʔϓΛද͢ • Role ͱ͔ఆٛͰ͖Δ (ৄ͘͠ޙड़)
Argo CDͷ RBAC
Argo CD ͷೝূ • ϩάΠϯը໘:
Argo CD ͷೝূ • ϩάΠϯը໘: User ͱ Password Λ ೖྗ͢Δεϖʔε͕͋Δ͕
Argo CD ͰΈࠐΈͷ admin Ҏ֎ͷϢʔβଘࡏ͠ͳ͍
Argo CD ͷೝূ • ϩάΠϯը໘: admin Ҏ֎ͷશͯͷϢʔβ SSO Λհͯ͠ϩάΠϯ͢Δ ඞཁ͕͋Δ
(͜ͷ߹ GitHub Λ༻)
Argo CD ͷೝূ • Argo CD Ͱ SSO Λߦ͏ํ๏ 2
छྨ • όϯυϧ͞ΕͯΔ Dex Λ༻͢Δ • طଘͷ OIDC provider Λ༻͢Δ
Argo CD ͷೝূ • Argo CD Ͱ SSO Λߦ͏ํ๏ 2
छྨ • όϯυϧ͞ΕͯΔ Dex Λ༻͢Δ • طଘͷ OIDC provider Λ༻͢Δ ࠓճ Dex Λͬͯ GitHub Ͱೝূ͢ΔΛ͠·͢
Dex Λ༻͍ͯ GitHub Ͱೝূ͢Δ • Argo CD Ͱ Dex ͱ͍͏
OIDC provider ͕όϯυϧ͞Ε͍ͯΔ • https://github.com/dexidp/dex
Dex Λ༻͍ͯ GitHub Ͱೝূ͢Δ • GitHub Ͱ OAuth application Λ࡞ͬͯ
`argocd-cm` ͱ͍͏ ConfigMap ʹ ઃఆΛهࡌ͢Δ
Dex Λ༻͍ͯ GitHub Ͱೝূ͢Δ • ConfigMap ͷྫ:
Dex Λ༻͍ͯ GitHub Ͱೝূ͢Δ • ConfigMap ͷྫ: ൃߦͨ͠ clientID ͱ
clientSecret $dex.github.clientSecret Έ͍ͨʹॻ͘͜ͱͰ Kubernetes ͷ Secret ͔Β ΛಡΈࠐΜͰ͘ΕΔ
Dex Λ༻͍ͯ GitHub Ͱೝূ͢Δ • ConfigMap ͷྫ: ϩάΠϯͰ͖Δ GitHub org
ͱ Team ͷઃఆ ͜ͷ߹ `classmethod` ͱ͍͏ GitHub org ͷ `sre-team` ͔͠ ϩάΠϯͰ͖ͳ͍
Role • GitHub-org:team ʹରͯ͠ AppProject ʹ ඥͮ͘Role ΛఆٛͰ͖Δ
Role • Argo CD ͷ Web UI ͔Β Delete, Edit
ͱ͔͕Ͱ͖ͨΓ͢Δ Role Λ੍ͬͯޚ͢Δ͜ͱ͕Ͱ͖Δ
Argo CDͷ Sync
Sync Phases • Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ
PreSync Sync PostSync
Sync Phases • Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ
PreSync Sync PostSync manifest ͷద༻લʹ࣮ߦ͞ΕΔ
Sync Phases • Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ
PreSync Sync PostSync manifest ͷద༻ʹ ؔ࿈࣮ͯ͠ߦ͞ΕΔ
Sync Phases • Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ
PreSync Sync PostSync manifest ͷద༻ޙʹ࣮ߦ͞ΕΔ
• Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ PreSync Sync
ΞϓϦέʔγϣϯ ͷσϓϩΠ DB ͷ ϚΠάϨʔγϣϯ PostSync Sync Phases ΞϓϦέʔγϣϯͷσϓϩΠલʹ Kubernetes ͷ Job Ͱ DB ͷϚΠάϨʔγϣϯΛ࣮ߦ
Sync Phases and Waves • Argo CD ͷ Sync ʹେ͖͚ͯ͘
3 ͭͷϑΣʔζ͕͋Δɹ PreSync ΞϓϦέʔγϣϯͷσϓϩΠલʹ Kubernetes ͷ Job Ͱ DB ͷϚΠάϨʔγϣϯΛ࣮ߦ DB ͷ ϚΠάϨʔγϣϯ
Sync Phases • Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ
PreSync DB ͷ ϚΠάϨʔγϣϯ annotation ʹهࡌΛ͢Δͱ Argo CD ͕هࡌͨ͠ϑΣʔζͰ ࣮ߦͯ͘͠ΕΔ
• Argo CD ͷ Sync ʹେ͖͚ͯ͘ 3 ͭͷϑΣʔζ͕͋Δɹ PreSync DB
ͷ ϚΠάϨʔγϣϯ PreSync ͷϑΣʔζ͕ ऴΘͬͨΒ Job Λআ Sync Phases
Sync Waves • ֤ϑΣʔζͰͷ manifest ͷద༻ॱΛ੍ޚͰ͖Δ PreSync Sync PostSync Job
Job Pod Job 1 2 3 v1.1.0 ͔Βͷ৽ػೳ
Sync Waves Sync Job Pod Job 1 2 3 •
֤ϑΣʔζͰͷ manifest ͷద༻ॱΛ੍ޚͰ͖Δ
Sync Waves Sync Job Pod Job 1 2 3 •
֤ϑΣʔζͰͷ manifest ͷద༻ॱΛ੍ޚͰ͖Δ `argocd.argoproj.io/sync-wave` ͱ͍͏ annotaion ʹ Λࢦఆ͢Δ
·ͱΊ
·ͱΊ • Argo CD Ϧονͳ Web UI Ͱ GitOps Ͱ͖Δπʔϧ
• ৭ʑͱࡉ͔͍ػೳͱ͔ॆ࣮ͯ͠Δ • ެࣜͷυΩϡϝϯτॆ࣮ͯ͠ΔͷͰΈΑ͏! • https://argoproj.github.io/argo-cd/
Thank You! @ponde_m