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.2k
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
300
Helm Chart を Unit Test する / Unit Testing Helm Chart
daikurosawa
0
1.9k
Understanding CPU throttling in Kubernetes to improve application performance #k8sjp
daikurosawa
12
14k
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
Oracle Database Release and Support Timelines 2024/12/11
wmo6hash
0
260
pmconf2024_UPSIDER
upsider_tech
0
8k
re:Invent2024のIaC周りのアップデート&セッションの共有/around-re-invent-2024-iac-updates
tomoki10
0
850
イベントをどう管理するか
mikanichinose
1
120
Connect × Server-Side Kotlinで実現する!スキーマ駆動開発と品質改善の実践
sansantech
PRO
1
180
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
150
ソフトウェアエンジニアとしてキャリアの螺旋を駆け上がる方法 - 経験と出会いが人生を変える / Career-Anchor-Drive
soudai
13
3k
re:Inventで発表された Bedrockの新機能を色々使って、マルチRAGエージェントにクラウド選定させてみた件
minorun365
PRO
4
280
Explain EXPLAIN
keiko713
10
2.9k
まだチケットを手動で書いてるの?!GitHub Actionsと生成AIでチケットの作成を自動化してみた話 / 20241207 Yoshinori Katayama
shift_evolve
1
830
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
210
AWS re:Invent 2024登壇資料(GBL206-JA: Unleashing the power of generative AI on AWS for your business)
minorun365
PRO
7
260
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
How STYLIGHT went responsive
nonsquared
95
5.2k
Typedesign – Prime Four
hannesfritz
40
2.4k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Agile that works and the tools we love
rasmusluckow
328
21k
Unsuck your backbone
ammeep
669
57k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
790
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
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