Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Kubernetesのオペレータを Kubernetes知らない人に説明
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Satoru Takeuchi
PRO
August 21, 2021
Technology
430
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kubernetesのオペレータを Kubernetes知らない人に説明
kanazawa.rb #108のLTスライドです
Satoru Takeuchi
PRO
August 21, 2021
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
70
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
94
あなたの知らないバージョン命名規則
sat
PRO
3
900
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
64
Machine Check Exception
sat
PRO
2
66
バイナリダンプの模様を読む
sat
PRO
0
89
cpコマンドはディスク上でデータを コピーしないことがある
sat
PRO
3
88
114-ファイルのshallow_copy.pdf
sat
PRO
2
58
113-Btrfsのスナップショット.pdf
sat
PRO
0
40
Other Decks in Technology
See All in Technology
映像変換サーバーなしで端末内でHLSを生成してライブ配信
hikarusato
0
130
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
120
Minecraft JavaのMODをSwiftで作る
1mash0
0
180
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
2026-09-11 【Snowflake World Tour Tokyo 2026】Snowflakeを起点に、AI Agentが自律稼働し続ける未来へ / Driving AI Agents with Snowflake
civitaspo
0
700
LLMに渡さなかった仕事
nanaism
0
820
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
4
310
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
2
550
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
130
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
0
160
AIは推し活である。
kurazuuuuuu
1
440
Reactの設計論
uhyo
24
14k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Everyday Curiosity
cassininazir
0
320
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
870
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
RailsConf 2023
tenderlove
30
1.5k
Unsuck your backbone
ammeep
672
58k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
Bash Introduction
62gerente
615
220k
How to make the Groovebox
asonas
2
2.4k
Documentation Writing (for coders)
carmenintech
77
5.5k
Transcript
Kubernetesのオペレータを Kubernetes知らない人に説明 Aug. 21th, 2021 kanazawa.rb #108 LT大会 Satoru Takeuchi
twitter: satoru_takeuchi 1
Kubernetesとは • 分散アプリ実行基盤 • 管理者はマニフェストと呼ばれるYAMLを書いて以下コマンド実行 ◦ kubectl apply app.yaml •
K8sはマニフェストの状態になるようにアプリを維持(後述) 2
従来型アプリ実行基盤との違い • やりたいこと ◦ nginxを2多重で動かす • 誰が何をするか ◦ 従来型: 手続き的の管理
▪ nginxを2つ動かす ▪ 1つ落ちたら人間が1つ再起動 • ansibleとかがやってたりもする ◦ Kubernetes: 宣言的の管理 ▪ 右のマニフェストをapply ▪ K8sが2個nginxを立ち上げる ▪ 1個落ちたらK8sが自動的に1つ再起動 • 宣言型のほうは”使うのは”楽 3 apiVersion: apps/v1 kind: ReplicaSet metadata: name: nginx spec: replicas: 2 template: spec: containers: - name: nginx image: nginx:1.14.2
Kubernetesのリソース • 個々のアプリはPodとよばれるコンテナのかたまりを示すリソースで定義 • アプリの多重度を維持するのがReplicasetリソース(*1) ◦ KubernetesがReplicaSetリソースのreplicasフィールドで定義された数、 Podリソースを作る ◦ KubernetesはPodリソースの数だけアプリを実行する
• PodやReplicaSetはK8sがデフォルトで提供している • 複雑なアプリの場合はReplicaSetやPodだけでは辛い 4 *1) 普通はDeploymentリソースを使うが説明は割愛
Custom Resource • 複雑なアプリ用に独自リソース(Custom Resource, CR)を作れる ◦ CRの定義をCustom Resource Definition(CRD)と呼ぶ
• 以下はRookという分散ストレージCeph用のCR ◦ storage以下でクラスタに組み込むディスクを定義 ◦ 全ノードの(使われていない)全ディスクをクラスに組み込む 5 apiVersion: ceph.rook.io/v1 kind: CephCluster spec: cephVersion: image: quay.io/ceph/ceph:v16.2.5 storage: useAllNodes: true useAllDevices: true
controllerとoperator • CRを操作するためのプログラム • CRDとcontrollerを合わせたものをoperatorという ◦ operator開発者が作る • 以下のように動作する ◦
CRに変化(生成、変更)があったときなど、状態に変化があったときに呼び出される ◦ あるべき姿との差分にしたがって必要な処理をする • たとえば前ページのCephCluster CRなら… ◦ K8sクラスタにノードを追加 ◦ CephClusterリソースを扱うRookのcontrollerが動く ◦ クラスタに登録されていない (新しいノード内の)ディスクがあることを検出 ◦ クラスタに新しいディスクを登録 6
operatorつらい話 • operatorのおかげで人間は楽をできる • ただし • operatorを実装する開発者はつらい ◦ 「差分を検出してあるべき姿にする」プログラムは書くのが大変 ◦
様々な泥臭いハックが必要 • 問題が出たときは結局ユーザもつらい ◦ トラブル解決のために operator、管理対象プログラムについての知見が必要 • 続きはWebで! ◦ オペレータの実装はつらい ◦ https://zenn.dev/satoru_takeuchi/articles/d8c37a037308d8 7