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
「L3以下は魔法で動いている!」と言いながらiptablesとkube-proxyを読んでみた話
Search
RyuSA
December 22, 2020
Technology
1
130
「L3以下は魔法で動いている!」と言いながらiptablesとkube-proxyを読んでみた話
社内LTでKubernetesのServiceを少し深堀した話を再編
RyuSA
December 22, 2020
Tweet
Share
More Decks by RyuSA
See All by RyuSA
Java屋だってOperatorが作りたい!
ryusa
1
530
Visual Studio Codeとコンテナでいい感じのRe:View執筆環境
ryusa
1
1.4k
JavaScriptと歩くポリシーエンジン jsPolicy
ryusa
1
530
TextAlive App APIと夢見る新しいUX
ryusa
1
370
Gitlab Operatorと夢見るGitlab自動化の旅
ryusa
2
990
AccessPoint Operator on Raspberry Pi
ryusa
1
1.1k
Serviceをたずねて3000行 - Kubernetesコードリーディングの旅 -
ryusa
2
820
そのAPIはセキュアですか?
ryusa
2
790
「〇〇完全に理解したったww」から始めるエンジニア生活
ryusa
2
4.3k
Other Decks in Technology
See All in Technology
情熱と工夫で走り抜け! コミュニティをささえるObservability実践録
b1gb4by
1
120
Streamline Cloud-Native App Development Using CDEs
saeedzf
0
520
Eight Engineering Unit 紹介資料
sansan33
PRO
0
3k
AIの電力問題を概観する
rmaruy
1
170
declaration mergingの威力:ライブラリアップデート時の書き換え作業を90%短縮するテクニック
yutake27
2
250
Digitization部 紹介資料
sansan33
PRO
1
3.7k
iOS/Androidで無限循環Carousel表現を考えてみる
fumiyasac0921
0
110
令和トラベルQAのAI活用
seigaitakahiro
0
390
エッジ活用の最適解とは? 新しいエッジ処理アーキテクチャ「Edge-as-a-Service」構想について
kakerucom
0
120
シンプルな設定ファイルで実現する AWS IAM Identity Center のユーザー管理と開発チームへの委譲 / Delegating AWS IAM Identity Center User Management with a Simple DSL
yamaguchitk333
3
450
Redmineの意外と知らない便利機能 (Redmine 6.0対応版)
vividtone
0
740
Swiftは最高だよの話
yuukiw00w
1
250
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Practical Orchestrator
shlominoach
187
11k
Optimizing for Happiness
mojombo
378
70k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
830
It's Worth the Effort
3n
184
28k
Writing Fast Ruby
sferik
628
61k
Facilitating Awesome Meetings
lara
54
6.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Transcript
と言いながら iptablesと kube-proxyを読んでみた話 L3以下は魔法で動いている!!!
本日のおはなし
Service なにもわからない
知っていること - Serviceはkube-proxyが深くかかわっている - Serviceはデフォルトでiptablesを使っているらしい - L3以下は魔法で動いている 知らないこと - iptablesの使いどころさん
- kube-proxyが何をしている?
実際に見てみる
(DeploymentとServiceを作成) Podを3つとSvcを作成
Workerノードのiptablesを眺める
iptables わからん \(^o^)/ 我、アプリ(?)の人間ぞ??
None
送信元192.168.0.0/16 から 送信先10.109.35.24/32 宛の TCPを転送しているっぽい?
送信元192.168.0.0/16 から 送信先10.109.35.24/32 宛の TCPを転送しているっぽい? nginxサービスのIPアドレス Kubeadmで設定したPodSubnet
None
確率で3つの場所に転送している……?
None
転送の最終宛先は各PodのIPアドレス
TCP発射 ↓ SvcのIPアドレス着弾 ↓ 確率(静的)分散 ↓ DNAT ↓ (魔法が発動する) ↓
PodのIPアドレスに転送
完全に理解した (なにもわかっていない)
ということでkube-proxy読んできた
None
None
更新処理
None
eventhandlers?
None
iptablesのProxiser
None
同期している?
None
どこかで初期化されているはず
None
これが走る
None
それっぽくない?
None
確率計算とレコード追加 Endpoint一覧をforで回す PodへのDNAT
完全に理解した (なにもわからなくなった)
おしまい