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
Claude Mythos、Fable...フロンティアAIの最新動向と企業のセキュリティ対策
flatt_security
0
170
なぜ、あなたのAPIは使われないのか? AX時代の設計原則、ガードレール、運用体制
yokawasa
1
260
最高のシステムプロンプトを作るためにフィードバック機能を導入した話
alchemy1115
0
220
大 AI 時代におけるC# の事情 ~ぶっちゃけトークを交えながら~
nenonaninu
1
530
人依存からAIネイティブの体制へ:バックエンド開発の裏側【SORACOM Discovery 2026】
soracom
PRO
0
130
人手不足への挑戦:車両保全を支えるIoTとクラウド内製化の道【SORACOM Discovery 2026】
soracom
PRO
0
160
なぜMIXIはゼロトラスト基盤として クラウドフレアを選んだのか - Cloudflare Peer Point SASE User Voices
mixi_engineers
PRO
2
130
2026年のソフトウェア開発を考える(2026/07版) / Agentic Software Engineering 2026-07 Findy Edition
twada
PRO
31
20k
数値で見る Microsoft MVP 〜Spec Kit と GitHub Copilot Agent で作るデータ可視化ダッシュボード〜
yutakaosada
0
170
どこまでAIに任せるか 〜確率論と決定論の境界決定〜
shukob
0
560
AWS環境のセキュリティ不安を解消した企業事例 ~よくある課題と対策を一挙公開~
asanoharuki
0
240
データエンジニアこそ組織のオントロジーに向き合うべき — 問いに答えるAIから、事業を動かすAIへ
gappy50
4
1.2k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
What's in a price? How to price your products and services
michaelherold
247
13k
The Curse of the Amulet
leimatthew05
2
13k
Everyday Curiosity
cassininazir
0
270
Docker and Python
trallard
47
4k
Navigating Weather and Climate Data
rabernat
0
420
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
460
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
For a Future-Friendly Web
brad_frost
183
10k
Raft: Consensus for Rubyists
vanstee
141
7.6k
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 サービスを開発する面白みの醍醐味