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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
コミットの「なぜ」を読む
ota1022
0
120
AIはどのように 組織のアジリティを変えるのか?
junki
4
1.3k
BPaaSで進むAIオペレーションの現在地 AI実装が効く領域とスケーラビリティの選定と実装
kentarofujii
0
150
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
110
「軸足」は 固定しなくていい - 熱量と強みで描く、しなやかなキャリアの形
kakehashi
PRO
1
260
2026年6月23日 Syncable Tech + Start Python Club にて
hamukazu
0
150
本当の”仕事”を手放せる未来が見えた
mu7889yoon
0
110
データレイクの「見えない問題」を可視化する
sansantech
PRO
1
200
レガシーな広告配信システムでのAI駆動開発/運用の挑戦
i16fujimoto
0
120
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
270
FPGAの開発コンペでZephyrを使ってみた
iotengineer22
0
200
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
180
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
210
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
480
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Typedesign – Prime Four
hannesfritz
42
3.1k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
260
Google's AI Overviews - The New Search
badams
0
1k
A Tale of Four Properties
chriscoyier
163
24k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
[SF Ruby Conf 2025] Rails X
palkan
2
1.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 サービスを開発する面白みの醍醐味