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
Write Kubernetes CustomController in Go
Search
moricho
December 04, 2019
Programming
1
150
Write Kubernetes CustomController in Go
moricho
December 04, 2019
Tweet
Share
More Decks by moricho
See All by moricho
Enhance Kubernetes Security with Gatekeeper
moricho
3
870
Deep Dive into Runtime Shim
moricho
3
1.7k
Recap: Zero Trust Service Mesh with Calico, SPIRE, and Envoy
moricho
1
870
gVisorで実現するこれからのコンテナセキュリティ
moricho
6
4.7k
Deep dive into sync.Pool
moricho
2
1k
Other Decks in Programming
See All in Programming
incrementalモデルの理解を深める
ikkimiyazaki
2
640
Creating Retro-Style Photos Using Swift
ski
1
340
「コンパイル時のユニットテスト」導入するとユニットテストを 書かなくてよくなるのか?
tomohisa
9
2.1k
自動テスト実行結果の目的を整理する / Organizing objectives of automated test results
twada
PRO
10
2.1k
App Router への移行は「改善」となり得るのか?/ Can migration to App Router be an improvement
takefumiyoshii
1
110
phpunit/php-code-coverageって何をしてるんだ #phperkaigi
o0h
PRO
2
210
Building a Smaller App Binary
kateinoigakukun
2
200
IntelliJ IDEA を知らなかった 自分に教えたい小ネタ集 / IntelliJ IDEA Hints for My Past Self
mackey0225
3
150
Ruby製社内ツールのGo移行
bgpat
2
260
とにかくHTTP3をライトニングに話す / Anyway, I'll talk to Lightning about HTTP3.
seike460
PRO
0
120
[スクリプト] Swiftの型推論を学ぼう
omochi
0
110
WebComponentsで フレームワークを1ページに共存させる
webuilder240
0
150
Featured
See All Featured
KATA
mclloyd
14
11k
Fontdeck: Realign not Redesign
paulrobertlloyd
75
4.8k
For a Future-Friendly Web
brad_frost
170
8.9k
The Art of Programming - Codeland 2020
erikaheidi
40
12k
The Brand Is Dead. Long Live the Brand.
mthomps
48
21k
GraphQLの誤解/rethinking-graphql
sonatard
48
9.1k
The Pragmatic Product Professional
lauravandoore
24
5.7k
Scaling GitHub
holman
456
140k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Writing Fast Ruby
sferik
619
59k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
657
120k
Transcript
Write Kubernetes CustomController in Go golang.tokyo #28 Dec.4
None
OVERVIEW golang.tokyo #28 Dec.4 ɾk8sͷ༻ޠͷ͓͞Β͍ ɾcontroller-runtimeΛ࣮ͬͨ ɾk8sͷControllerͱʁ
k8sͷ͓͞Β͍ ɾPod : ϫʔΫϩʔυͷ࠷খ୯Ґ ex. Goίϯςφ(API) + fluentdίϯςφ(logging) ɾReplicaSet :
͋ΔPodͷू߹
k8sͷControllerͱʁ k8sManifest(yaml)Ͱ·͍͠ঢ়ଶΛએݴ => ͦͷঢ়ଶΛҡ࣋͠ଓ͚Δ ref) Operator Basic in CNDK2019 -
speakerdeck
k8sͷControllerͱʁ
k8sͷControllerͱʁ
k8sͷControllerͱʁ
k8sͷControllerͱʁ k8s෦Ͱ͜ͷॲཧΛ ܁Γฦ͍ͯ͠Δ => ͋Δ͖ঢ়ଶͱ ɹ ݱࡏͷঢ়ଶΛ߹ΘͤΔ
CustomController controllerࣗલͰ࡞Δ͜ͱͰ͖Δ => ͦΕ͕CustomController kubernetes-sigs/controller-runtime ͱ͍͏ϥΠϒϥϦ͕ఏڙ͞Ε͍ͯΔ
controller-runtimeΛ ࣮ͬͨ ࠓճͷαϯϓϧɿ ReplicaSet͕࡞͞ΕͨΒɺ ͦͷཧԼͷίϯςφ໊Λදࣔ͢Δ ίϯτϩʔϥʔ
controller-runtimeΛ ࣮ͬͨ (controller.go) ͲͷϦιʔεΛऔಘͯ͠ɺͲ͏͍͏ॲཧΛ࣮ߦ͢Δ͔ ɾ Reconciler ɾ
controller-runtimeΛ ࣮ͬͨ (controller.go) Namespace, Ϧιʔε(ReplicaSet)Λࢦఆͯ͠ɺ ϦιʔεͷใΛऔಘɺίϯςφ໊Λग़ྗ ɾ
controller-runtimeΛ ࣮ͬͨ (main.go) ControllerΛੜ ɾ ઌ΄Ͳఆٛͨ͠ReconcilerΛࢦఆ ɾ
controller-runtimeΛ ࣮ͬͨ (main.go) ɾࢦఆͨ͠ϦιʔεΛControllerͰࢹ ɾ ɾReplicaSetʹߋ৽͕͋ͬͨΒɺઌ΄ͲͷॲཧΛ࣮ߦ
controller-runtimeΛ ࣮ͬͨ ReplicaSetΛ࡞ͨ͠Βɺ ͦͷཧԼͷίϯςφͷ໊લ͕ දࣔ͞Εͨ 70ߦ͘Β͍Ͱ؆୯ʹॻ͚ͨ
࣮༻తͳControllerΛ࡞͍͖͍ͬͯͨ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ