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
10
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
51
Other Decks in Technology
See All in Technology
LayerX コーポレートエンジニアリング室におけるサプライチェーンセキュリティへの取り組み / Supply Chain Security at LayerX Corporate Engineering
yuyatakeyama
3
830
AIチャット検索改善の3週間
kworkdev
PRO
2
170
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
200
Multi-Agent並列開発を 安全に回すための技術 / Technology for Safely Multi-Agent Parallel Development
tooppoo
0
140
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
130
現場のトークンマネジメント
dak2
1
190
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
110
作る力から、見極める力へ — AI時代に広がるエンジニアの価値と役割
rince
0
330
iOS アプリの「これって不具合ですか?」を AI に調べてもらう
miichan
0
140
AI 不只幫你寫 Code: 當專案從 300 暴增到 1500, 我們如何撐住 DevOps
appleboy
0
220
ぼっちではじめた登壇が「51名」「241件」の発信に化けた
subroh0508
1
310
事業会社における 機械学習・推薦システム技術の活用事例と必要な能力 / ml-recsys-in-layerx-wantedly-2026
yuya4
0
160
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.8k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
740
Product Roadmaps are Hard
iamctodd
PRO
55
12k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
4 Signs Your Business is Dying
shpigford
187
22k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
170
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Designing for Timeless Needs
cassininazir
1
260
Claude Code のすすめ
schroneko
67
230k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
310
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 サービスを開発する面白みの醍醐味