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
Satoru Takeuchi
PRO
August 21, 2021
Technology
440
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
Transcript
7 slides
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
More Decks by Satoru Takeuchi
See All by Satoru Takeuchi
Btrfsのsnapshotとランダム書き込み
sat
PRO
0
51
ファイルシステムのデフラグ
sat
PRO
1
58
コピーオンライト型ファイルシステムと ランダム書き込み
sat
PRO
2
130
119-多機能ファイルシステムBtrfs_のコピー.pdf
sat
PRO
1
90
Linuxカーネルの インタフェースは変わりうる?
sat
PRO
1
120
あなたの知らないバージョン命名規則
sat
PRO
3
940
Rook: Intro and Deep Dive with Ceph
sat
PRO
1
87
Machine Check Exception
sat
PRO
2
78
バイナリダンプの模様を読む
sat
PRO
0
120
Other Decks in Technology
See All in Technology
そのイメージ、どのCIが作った? Artifact Attestationsで来歴を固定する / Which CI system created that image? Pinning provenance with Artifact Attestations
chmikata
0
130
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
200
AWS Emulator を評価する: 手元で動く AWS の API の仕組み、始め方、確かめ方
inariku
PRO
2
780
IP重複は"ランディングVPC"で受け止める ― PrivateLink と Transit Gatewayによるマルチテナント接続基盤の設計
hatahata021
3
250
高品質と高スピードを支える品質のシフトレフトのアプローチ
goyoki
4
1.7k
CloudTrail を推したい
kazzpapa3
1
150
Taking back control of your AI development
inesmontani
PRO
0
300
その修正で本当に速くなったのか? k6とOpenTelemetryで確かめる性能改善 / Performance review with k6 and OpenTelemetry
ymotongpoo
3
330
落とし穴にハマってわかった 開発生産性を測るときに気をつけたいこと
munakata
3
460
AIで実装が加速したのに、 なぜ私は仕事の大半で人と話し続けていたのか?
say_no_w
0
200
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
560
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
17
120k
Featured
See All Featured
Test your architecture with Archunit
thirion
2
2.5k
Writing Fast Ruby
sferik
630
63k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
760
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
570
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
640
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.8k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
310
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
570
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
310
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k