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
180
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
「L3以下は魔法で動いている!」と言いながらiptablesとkube-proxyを読んでみた話
社内LTでKubernetesのServiceを少し深堀した話を再編
RyuSA
December 22, 2020
More Decks by RyuSA
See All by RyuSA
Java屋だってOperatorが作りたい!
ryusa
1
610
Visual Studio Codeとコンテナでいい感じのRe:View執筆環境
ryusa
1
1.6k
JavaScriptと歩くポリシーエンジン jsPolicy
ryusa
1
610
TextAlive App APIと夢見る新しいUX
ryusa
1
460
Gitlab Operatorと夢見るGitlab自動化の旅
ryusa
2
1.1k
AccessPoint Operator on Raspberry Pi
ryusa
1
1.3k
Serviceをたずねて3000行 - Kubernetesコードリーディングの旅 -
ryusa
2
930
そのAPIはセキュアですか?
ryusa
2
850
「〇〇完全に理解したったww」から始めるエンジニア生活
ryusa
2
4.6k
Other Decks in Technology
See All in Technology
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
450
SRE Next 2026 何でも屋からの脱却
bto
0
630
脱金融のフューチャー・デザイン / Future Design Beyond Finance
ks91
PRO
0
150
SRE依存からの脱却 運用を開 発チームへ移す、 フルサイ クル開 発体制の実践
joooee0000
0
2.7k
SRE本の知られざる名シーン / The Hidden Gems of Google SRE Book
nari_ex
1
370
キャリアの中で本を作る / Making a Book During Your Career
ak1210
0
130
Claude Code 珍プレー好プレー
shinyasaita
0
320
世界、断片、モデル。そして理解
ardbeg1958
1
110
知らん間に、回ってる
ming_ayami
0
520
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
13
2k
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
4
4.1k
Keeping applications secure by evolving OAuth 2.0 and OpenID Connect
ahus1
PRO
1
160
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
550
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
600
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Making the Leap to Tech Lead
cromwellryan
135
10k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
630
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
800
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
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
完全に理解した (なにもわからなくなった)
おしまい