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
k8s ecosystem management with using of Argo CD
Search
Kota Kimura
October 07, 2023
Technology
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
k8s ecosystem management with using of Argo CD
Kota Kimura
October 07, 2023
More Decks by Kota Kimura
See All by Kota Kimura
Operating and Migrating OpenTelemetry Collector in a 100-Cluster-Scale Multi-Tenant Environment
kkk777
0
11
KubeCon NA 2024 Recap
kkk777
0
22
Getting Started kubernetes
kkk777
0
66
story about confronting node failure due to excessive memory consumption in kubelet
kkk777
1
56
Other Decks in Technology
See All in Technology
脱金融のフューチャー・デザイン / Future Design Beyond Finance
ks91
PRO
0
160
SRE本の知られざる名シーン / The Hidden Gems of Google SRE Book
nari_ex
1
420
しぶいSRE: サーバから見えない障害にどう向き合うか。ラストワンマイルのデバッグ実践 / Shibui SRE
kanny
13
6.5k
ボーイスカウトルールでメモリやスキルを改善しよう
azukiazusa1
4
1.4k
企業でAWS Organizationsを動かすための組織設計の考え方
nrinetcom
PRO
1
110
DMM.com 購入改善推進チーム におけるCodeRabbitを用いた レビューフロー改善の一例
ysknsid25
2
670
AI時代のYAGNI:「爆速で無駄になった機能」からの学び / 20260720 Naoki Takahashi
shift_evolve
PRO
2
320
非定型なドキュメントを効率よくリファクタする 〜えぇ!?仕様書27本の移行が1日で終わったって!?〜
subroh0508
2
550
CIで使うClaude
iwatatomoya
0
290
AIレビューはどこまで任せられるのか?自動化と人が背負うレビューの境界
sansantech
PRO
3
1.1k
ZOZOTOWNの進化と信頼性を両立する負荷試験
zozotech
PRO
2
190
壊して学ぶAWS CDK: そのcdk deployで消えるもの、残るもの
k_adachi_01
1
400
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
430
First, design no harm
axbom
PRO
2
1.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
880
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
320
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
RailsConf 2023
tenderlove
30
1.5k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
630
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Faster Mobile Websites
deanohume
310
32k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Transcript
Argo CD をフル活用した k8s エコシステム管理 Hackers Champloo CyberAgent group Infrastructure
Unit Kota Kimura
目次 1. Kubernetes 運用の課題 2. サイバーエージェントの KaaS AKE
3. Argo CD を活用した エコシステム管理 4. まとめ
自己紹介 木村 洸太 - Kota Kimura • 株式会社サイバーエージェント グループIT推進本部 CIU所属
2023年5月中途入社 • KaaS プロダクト AKE の開発・運用を担当 • 趣味はサウナ巡り 以前の沖縄来訪時の思い出 @ KKimura
Kubernetes 運用の課題 Kubernetes って、運用大変って聞くけど何が大変なの?本当に辛いの? • Kubernetes クラスタ自体の管理 • Kubernetes では足りない部分を埋めるエコシステムの管理
Kubernetes 運用の課題 Kubernetes って、運用大変って聞くけど何が大変なの?本当に辛いの? • Kubernetes クラスタ自体の管理 自前のオンプレ Kubernetes は大変だが、、、
マネージド Kubernetes (GKE / EKS / AKS) の利用で大幅カットできる 参考になる資料やブログ記事などもかなりたくさんある!! ※ 3ヶ月に1回 マイナーバージョンが上がっていくので、アップデート戦略は検討必要有
Kubernetes 運用の課題 Kubernetes って、運用大変って聞くけど何が大変なの?本当に辛いの? • Kubernetes では足りない部分を埋めるエコシステムの管理 そもそも塩漬けになりがち.... → k8s
API の廃止などのタイミングであげる エコシステムのマニフェストを手動で取得、書き換えて利用すると... Upstream の追従コストが高い オプションの変更 、推奨設定への変更、RBAC変更、etc ArgoCD / Prometheus / External Secret など
AKE - Kubernetes as a Service
AKE - Kubernetes as a Service • ユーザーが指定の k8s バージョンでクラスタを利用できる
→ ClusterAPI で実現 • 各クラスタで利用するアドオンの Enable / Disable が切り替え可能 → ArgoCD で実現 管理クラスタ ユーザークラスタ v1.26.5 External DNS v1.27.1 Cluster Autoscaler, ingress v1.25.10 Prometheus, External Secret プライベートクラウド版 マネージド Kubernetes
Argo CD を活用したエコシステム管理
再喝 : AKE - Kubernetes as a Service • ユーザーが指定の
k8s バージョンでクラスタを利用できる → ClusterAPI で実現 • 各クラスタで利用するアドオンの Enable / Disable が切り替え可能 → ArgoCD で実現 管理クラスタ ユーザークラスタ v1.26.5 External DNS v1.27.1 Cluster Autoscaler, ingress v1.25.10 Prometheus, External Secret プライベートクラウド版 マネージド Kubernetes これどう実現するの???
ざっくり Argo CD watch k8s クラスタ Argo CD deploy
kind: Application metadata: metadata: name: app spec: project: default source: repoURL:
[email protected]
:xxxxx/addons.git targetRevision: main path: xxx destination: server: 10.0.0.1:6443 namespace: app Application リソース ※ Argo CD 自体も k8s リソースとして定義して k8s クラスタ内にデプロイします ※ 所属チームでは、Argo CD 用クラスタ (管理クラスタ)に展開し 後述の ApplicationSet で各ユーザクラスタの同期をします 10.0.0.1:6443
[email protected]
:xxxxx/addons.git Kustomize / Helm によるデプロイが多い
Argo CD ApplicationSet Generator 条件にしたがって、Application リソースを作成する拡張機能 ApplicationSet : • Cluster
generator Argo CD Cluster Secret を条件に作成 ※ 他にも Git generator など様々あります kind: ApplicationSet metadata: name: app spec: generators: - clusters: {} template: metadata: name: 'app-{{ name }}' spec: project: default source: repoURL:
[email protected]
:xxxxx/addons.git targetRevision: main path: manifests/example-app/overlays/release destination: server: '{{ server }}' kind: Secret metadata: name: kimura namespace: argocd stringData: name: kimura-cluster server: 10.0.0.1:6443 config: (Argo CD の kubeconfig 相当) kind: Secret metadata: name: hackers-champloo namespace: argocd stringData: name: champloo-cluster server: 10.0.0.2:6443 config: (Argo CD の kubeconfig 相当) kind: Application metadata: metadata: name: app-kimura-cluster spec: .... destination: server: 10.0.0.1:6443 kind: Application metadata: metadata: name: app-champloo-cluster spec: .... destination: server: 10.0.0.2:6443 https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators/ ※ Cluster が作成されたら、Secret リソースを作成する自作カスタムコントローラーを開発
利用アドオンの切り替え Generator の Selector を利用 kind: ApplicationSet metadata: name:
app spec: generators: - clusters: selector: matchExpressions: - key: addons.ake.cycloud.io/app operator: In values: - “true” template: {...} Argo CD Cluster Secret の label / annotation の値を元に Application リソースを作成するか分岐 kind: Secret metadata: name: kimura namespace: argocd labels: addons.ake.cycloud.io/app: “true” addons.ake.cycloud.io/app2: “false” stringData: {...} kind: Secret metadata: name: hackers-champloo namespace: argocd labels: addons.ake.cycloud.io/app: “false” addons.ake.cycloud.io/app2: “false” stringData: {...} kind: Application metadata: metadata: name: app-kimura-cluster spec: .... destination: server: 10.0.0.1:6443 ユーザーのクラスタ作成/更新時のパラメータを元に Secret リソースの labelの値を設定
アプリケーションの挙動変更 ユーザーが指定する値を変数として、アプリケーションに渡して、挙動を変更したい ex) Datadog で利用する API Key • Helm
で デプロイする場合 values に値を渡して挙動を変更可能 kind: ApplicationSet metadata: name: datadog spec: template: spec: source: helm: parameters: - name: ake.apikey value: {{ metadata.annotations…}} • Kustomize で デプロイする場合 ApplicationSet の機能では、外部からパラメータを渡すことができない 後述の Argo CD Config Management Plugins を実装することで実現
Argo CD Config Management Plugins 任意のコマンドを実行して、マニフェストを生成できるプラグイン機能 argocd-repo-server の サイドカーコンテナとして設定を加える apiVersion:
apps/v1 kind: Deployment metadata: name: argocd-repo-server spec: {...} containers: - name: my-plugin command: [/var/run/argocd/argocd-cmp-server] image: quay.io/argoproj/argocd volumeMounts: {...} - mountPath: /home/argocd/cmp-server/config/plugin.yaml subPath: plugin.yaml name: cmp-my-plugin volumes: - configMap: name: my-plugin-config name: cmp-my-plugin apiVersion: v1 kind: ConfigMap metadata: name: my-plugin-config data: plugin.yaml: | apiVersion: argoproj.io/v1alpha1 kind: ConfigManagementPlugin metadata: name: my-plugin spec: init: command: [sh, -c, 'echo "Initializing..."'] generate: command: [sh, -c, 'echo "Generating…”] init (前処理) と generate(生成処理) を定義できる Config Map をサイドカーにマウント
Argo CD Config Management Plugins 具体例 : sed 等で該当ファイルの値を埋める apiVersion:
v1 kind: ConfigMap metadata: name: my-plugin-config data: plugin.yaml: | {...} spec: init: command: [sh, -c, “ sed -i -e \”s|__CPU_LIMIT__|$ARGOCD_ENV_CPU_LIMIT|g\” ./my-replace.yaml ] generate: command: [ kustomize, build, . ] apiVersion: v1 kind: Pod metadata: name: example spec: {...} resources: limits: cpu: __CPU_LIMIT__ my-replace.yaml 値の書き換え 値の代入 kind: ApplicationSet metadata: name: my-app spec: template: spec: source: plugin: name: my-plugin env: - name: CPU_LIMIT value: {{ metadata.annotations…}} ※ Application から 渡される環境変数では、 prefix に 「ARGOCD_ENV」がつく
まとめ
まとめ • Argo CD の機能を活用することで柔軟にエコシステムの管理が可能 • Argo CD は多機能で面白い!今後も Deep
Dive していきたい! • とはいえ複雑なカスタマイズをしすぎると運用負荷が高まるので 柔軟性をどこまで持たせるかを考えるのが、 Platform サービスを開発する面白みの醍醐味