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
SRE Book Club - Kubernetes - ch32-35 - Network
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Rico Chen
August 15, 2019
Programming
74
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SRE Book Club - Kubernetes - ch32-35 - Network
Kubernetes CNI solutions
Rico Chen
August 15, 2019
More Decks by Rico Chen
See All by Rico Chen
How to monitor Cosmos validator by Prometheus
ricotoothless
0
670
how-to-choose-cicd-tools.pdf
ricotoothless
0
130
SRE Book Club - Linux - ch45 - Where's socket buffer
ricotoothless
0
190
SRE Book Club - Linux - ch38 - tcpdump & Wireshark
ricotoothless
0
78
COSCUP - Dynamic Jenkins Agent on Kubernetes
ricotoothless
0
70
Taiwan CDK Meetup - Rookie operator's CDK journey
ricotoothless
0
270
DevOps Taiwan 2020 Workshop - Jenkins CICD
ricotoothless
0
100
SRE Book Club - Kubernetes - ch22 - Job & CronJob
ricotoothless
0
50
Other Decks in Programming
See All in Programming
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
ActionController meets Protocol Buffers
sorah
0
560
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.6k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
270
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Railsバージョンを4倍にした話
optim
0
450
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
気持ちぃ〜角丸 Squircle
ryu1013
0
310
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
140
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
How to Talk to Developers About Accessibility
jct
2
580
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
Speed Design
sergeychernyshev
33
2.2k
Producing Creativity
orderedlist
PRO
348
41k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
Transcript
CH 32~35 Kubernetes 容器器網路路
Overview • OSI Model & TCP/IP Model • Layer 2
- Data Link Layer • Layer 3 - Network Layer • Layer 4 - Transport Layer • Tunnel • Flannel • Calico
OSI Model vs TCP/IP Model
Data Encapsulation Data_De-encapsulation
Layer 2 - Data Link Layer HUB Bridge Switch Router
Collision Domain 1 4 4 4 Broadcast Domain 1 1 1 4
MAC Address • ⽤用在 2 層的地址 • 只要是網卡都有 MAC address
,包括 Switch 和 Router 上 所有的網卡 • Bridge & Switch 會慢慢學習並且建⽴立 MAC Address Table (本質上就是 database),下⼀一次就知道要發送到哪個 port ,不不像 HUB ⼀一直無腦發送給整個 LAN • Layer 2 Header 裡⾯面重要的資訊有 Destination MAC Address & Source MAC Address
Layer 3 - Network Layer • 常⾒見見的 Protocol 有 IP
、ICMP 、DHCP 、 ARP (也有⼈人 分類類在 Layer 2.5 ) • Router 在運作時基本上 AND 運算不不會算完整的 IP Address ,只會算到 Subnet Mask 的地⽅方。 (例例如: 10.55.123.55/16 Router 在轉發時只會看到 10.55.0.0/16)
ARP • 全名為 Address Resolution Protocol , 有個稱號為「無名英雄」 • 把
IP Address 解析為 MAC Address 的 Protocol • 流程 1. 先查找⾃自⼰己 PC 的 ARP table 是否有存在 IP & MAC 對應的紀錄錄 2. 針對⽬目的 IP 發出 ARP 廣播封包 3. ⽬目的 IP (有可能是網路路設備或⼀一般 PC )回應 ARP reply 封包 (內含 MAC 解答) 4. 當收到⽬目的 MAC 後才會正式送出 ping or http 封包給接受端
Router 扮演的⻆角⾊色 ? 10.3.1.23
Layer 4 - Transport Layer • 網路路的世界沒有 100 % 的送達率,你的包⼀一定會掉,所以
依據 Application 層的特性決定要使⽤用 UDP or TCP • UDP 會盡量量送達封包,但沒有確認送達的機制,好處是 Header 輕量量且快 • TCP 在 Header 裡有 Flags 讓三向交握開啟 Connection , 確保封包即使掉了了也會重傳。 ( 修改 Flags 也是駭客常⾒見見 的⼿手法)
Tunnel • VPN Tunnel mode 讓遠端辦公室的連線就像在區域網路路互 通⼀一樣。( 兩端的 IP 都是
private IP ) • VXLAN 為 VLAN 的進階版本,VLAN 最多只能切 4096 個 ,但為了了對應 Datacenter 需要切更更多的 VLAN , VXLAN 最多可以切到 16777216 個 VXLAN( 2 的 24 次 ⽅方)。
VPN Tunnel • 原本⼀一般的封包往前塞加密的 Header 與 Outer IP Header •
加密資訊是兩邊的 Router 事先設定好的 • VPN 的封包在 Internet 傳遞時,Internet 上的 Router 只會 看 Outer IP Header 的 IP 資訊來來增加傳遞速度。
VPN Tunnel data IP MAC data IP data IP Outer
IP data IP MAC
VXLAN Tunnel • 傳統 VLAN 的做法其實已經在⼀一般的封包中間硬塞⼀一段 Header ( IEEE 802.1Q
) • VXLAN 因為要有 Tunnel 的功能,所以 Header 往前塞
VXLAN Tunnel
VXLAN Tunnel
Flannel VXLAN Question • ⽬目的 VTEP Device 的 MAC Address
是什什麼,ARP 不不像 VXLAN Protocol ⼀一樣可以跨網段。 因為 flanneld 在 Node 2 建⽴立 process 的時候,會⾃自動新 增 ARP 記錄錄到其他 Node 1 上。 • 課堂中的 VXLAN 例例⼦子沒那麼好,因為沒有跨網段。
Flannel VXLAN packet S-IP: 10.244.0.2 D-IP: 10.244.1.3 S-MAC:10.244.0.2 D-MAC:10.244.0.1 #
route -n Destination Gateway Iface 0.0.0.0 10.244.0.1 eth0 10.244.0.0 0.0.0.0 eth0 $route -n Destination Gateway Iface 0.0.0.0 10.168.0.254 eth0 10.244.0.0 0.0.0.0 cni0 10.244.1.0 10.244.1.0 flannel.1 S-MAC:10.244.0.2 D-MAC: S-MAC:10.244.0.2 D-MAC:10.244.1.0 VNI: 1 UDP port: 8285 S-IP: 10.168.0.2 D-IP: 10.168.0.3 S-MAC:10.168.0.2 D-MAC:10.168.0.3 $route -n Destination Gateway Iface 0.0.0.0 10.168.0.254 eth0 10.244.0.0 0.0.0.0 cni0 10.244.1.0 10.244.1.0 flannel.1 $route -n Destination Gateway Iface 0.0.0.0 10.168.0.254 eth0 10.244.1.0 0.0.0.0 cni0 10.244.0.0 10.244.0.0 flannel.1 S-MAC:10.244.0.2 D-MAC: S-MAC:10.244.0.2 D-MAC:10.244.1.1
Flannel Host-gw Question • 如何取得 routing table ? 網段和 node
的資訊都在 etcd 上,從 kubeadm join 時把資 訊就寫在 etcd 上了了, Flanneld 會⼀一直 WATCH etcd 上的 內容。 • 為什什麼 Host-gw 沒辦法跨網段? 因為沒有往前塞 Header 無法騙過 network device 。如果 有不不同網段的封包會被 switch 送到 router ,router 沒有對 應的 routing 規則的話會 drop 掉封包。
Flannel Host-gw packet S-IP: 10.244.0.2 D-IP: 10.244.1.3 S-MAC:10.244.0.2 D-MAC:10.244.0.1 S-MAC:10.244.0.2
D-MAC: S-MAC:10.244.0.2 D-MAC: 10.168.0.3
Calico BGP Question • 如何取得 routing table ? 跟 Flannel
最⼤大的不不同是使⽤用 BGP 取得 routing 資訊,並 且把資訊寫到 Felix 裡,然後 Felix 會把 routing table 寫到 Linux Kernel 裡。 • 為什什麼 Calico BGP mode 沒有辦法跨網段? 其運作原理理跟 Flannel Host-gw ⼀一樣。 因為沒有往前塞 Header 無法騙過 network device 。如果 有不不同網段的封包會被 switch 送到 router ,router 沒有對 應的 routing 規則的話會 drop 掉封包。
Calico BGP murmur • 通常 router 直接串串 PC 是很浪費且罕⾒見見的事情,雖然是虛 擬的
network device,但 Calico BGP 做了了這個罕⾒見見的示 範。
Calico BGP packet
Calico IPIP Question • 為什什麼 Calico IPIP mode 沒那麼盛⾏行行? 同常來來說,⼀一個
network device 需要特定的功能必須去設 定 enable ,就像⼀一開始的 router 沒有 enable OSPF, NAT or VPN 就什什麼功能都沒有。 問題就在管理理,有些組織即使是維運單位也不不⼀一定有權限 可以設定 network device enable BGP ,更更何況公有雲。
Calico IPIP Packet • Calico IPIP mode 也有採⽤用 Tunnel (硬是要往前塞
Header)的技術,讓沿路路上的 router 看到的都是不不同的網 段,再搭配 BGP 得到不不同網段之間的 routing table 就可以 正常的送封包了了。
Calico IPIP packet
Reference • https://bit.ly/2ZaaW4L • https://bit.ly/2Z0RWkW • https://bit.ly/2MRCXrk • https://bit.ly/2Z1oBqS •
https://bit.ly/2YQ8264