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
From network namespace to fabric overlay
Search
Eugene Yakubovich
August 19, 2015
Technology
0
36
From network namespace to fabric overlay
My talk from ContainerCon 2015
Eugene Yakubovich
August 19, 2015
Tweet
Share
More Decks by Eugene Yakubovich
See All by Eugene Yakubovich
Container Network Interface: Network plugins for Kubernetes and beyond
eyakubovich
0
270
CoreOS NYC Meetup
eyakubovich
2
230
Other Decks in Technology
See All in Technology
さいきょうのアーキテクチャを生み出すセンスメイキング
jgeem
0
270
“自分”を大切に、フラットに。キャリアチェンジしてからの一年 三ヶ月で見えたもの。
maimyyym
0
300
Makuake*UPSIDER_LightningTalk
upsider_tech
0
200
顧客の声を集めて活かすリクルートPdMのVoC活用事例を徹底解剖!〜プロデザ!〜
recruitengineers
PRO
0
200
Japan AWS Jr. Championsがお届けするre:Invent2024のハイライト ~ラスベガスで見てきた景色~
fukuchiiinu
0
1.1k
Amazon Aurora バージョンアップについて、改めて理解する ~バージョンアップ手法と文字コードへの影響~
smt7174
1
250
GitLab SelfManagedをCodePipelineのソースに設定する/SetGitLabSelfManagedtoCodePipeline
norihiroishiyama
1
120
例外処理を理解して、設計段階からエラーを「見つけやすく」「起こりにくく」する
kajitack
12
3.8k
Fin-JAWS第38回reInvent2024_全金融系セッションをライトにまとめてみた
mhrtech
1
110
インシデントキーメトリクスによるインシデント対応の改善 / Improving Incident Response using Incident Key Metrics
nari_ex
0
4.1k
もし今からGraphQLを採用するなら
kazukihayase
9
4.2k
ChatGPTを使ったブログ執筆と校正の実践テクニック/登壇資料(井田 献一朗)
hacobu
1
160
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
96
5.3k
YesSQL, Process and Tooling at Scale
rocio
171
14k
How GitHub (no longer) Works
holman
312
140k
Embracing the Ebb and Flow
colly
84
4.5k
Writing Fast Ruby
sferik
628
61k
Visualization
eitanlees
146
15k
Making Projects Easy
brettharned
116
6k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
Become a Pro
speakerdeck
PRO
26
5.1k
4 Signs Your Business is Dying
shpigford
182
22k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Transcript
From network namespace to fabric overlays Eugene Yakubovich @eyakubovich
Containers are awesome - Containers provide isolation - For networking
- its own port space - its own IP
Network Namespace - Can every container have a "real" IP?
- How should network be virtualized? - Is network virtualization part of "container runtime"?
$ sudo unshare -n /bin/bash $ ip addr 1: lo:
<LOOPBACK> mtu 65536 ... link/loopback 00:00:00:00:00:00 brd ... New net ns
$ ip link set lo up $ ip addr 1:
lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ... link/loopback 00:00:00:00:00:00 brd ... inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever New net ns
$ ping 8.8.8.8 connect: Network is unreachable $ ip route
show $ New net ns
veth 10.0.1.5/31 10.0.1.4 10.0.1.7/31 10.0.1.6
veth 10.0.1.5/24 10.0.1.7/24 10.0.1.1/24
Virtualizing the NIC and Network - veth pair (plus linux-bridge)
- macvlan - ipvlan - OVS - vlan - vxlan
IP Address Management - Host - Cluster - Global
Which one? No right answer!
Need pluggable network strategy
Container Runtime (e.g. rkt) veth macvlan ipvlan OVS
Container Runtime (e.g. rkt) veth macvlan ipvlan OVS
Container Runtime (e.g. rkt) veth macvlan ipvlan OVS Container Networking
Interface (CNI)
CNI - Container can join multiple networks - Network described
by JSON config - Plugin supports two commands - Add container to the network - Remove container from the network
User configures a network $ cat /etc/rkt/net.d/10-mynet.conf { "name": "mynet",
"type": "bridge", "ipam": { "type": "host-local", "subnet": "10.10.0.0/16" } }
CNI: Step 1 Container runtime creates network namespace and gives
it a named handle $ cd /run $ touch myns $ unshare -n mount --bind /proc/self/ns/net myns
CNI: Step 2 Container runtime invokes the CNI plugin $
export CNI_COMMAND=ADD $ export CNI_NETNS=/run/myns $ export CNI_CONTAINERID=5248e9f8-3c91-11e5-... $ export CNI_IFNAME=eth0 $ $CNI_PATH/bridge </etc/rkt/net.d/10-mynet.conf
CNI: Step 3 Inside the bridge plugin (1): $ brctl
addbr mynet $ ip link add veth123 type veth peer name $CNI_IFNAME $ brctl addif mynet veth123 $ ip link set $CNI_IFNAME netns $CNI_IFNAME $ ip link set veth123 up
CNI: Step 3 Inside the bridge plugin (2): $ IPAM_PLUGIN=host-local
# from network conf $ echo $IPAM_PLUGIN { "ip4": { "ip": "10.10.5.9/16", "gateway": "10.10.0.1" } }
CNI: Step 3 Inside the bridge plugin (3): # switch
to container namespace $ ip addr add 10.0.5.9/16 dev $CNI_IFNAME # Finally, print IPAM result JSON to stdout
Current plugins Top level ptp bridge macvlan ipvlan IPAM host-local
dhcp
Q: How do we give each container a routable IP
in "restricted" env? A: Overlay network: flannel, weave
None
None
{ "network": "10.1.0.0/16" }
10.1.16.0/24 10.1.24.0/24 10.1.71.0/24
10.1.16.0/24 # /run/flannel/subnet.env FLANNEL_NETWORK=10.1.0.0/16 FLANNEL_SUBNET=10.1.16.0/24 FLANNEL_MTU=1472
10.0.16.0/24 10.1.24.0/24 10.1.71.0/24 10.1.16.2 10.1.24.3
Putting it all together CNI
flannel CNI plugin - "meta" plugin - reads in /run/flannel/subnet.env
- writes out "bridge" + "host-local" conf - calls out to "bridge"
{ "name": "mynet", "type": "flannel" } # /run/flannel/subnet.env FLANNEL_NETWORK=10.1.0.0/16 FLANNEL_SUBNET=10.1.16.0/24
FLANNEL_MTU=1472 { "name": "mynet", "type": "bridge", "mtu": 1472, "ipam": { "type": "host-local", "subnet": "10.1.16.0/24" } }
$ sudo rkt run --private-net=mynet --interactive debian.aci (debian) $ ip
addr … 10.1.16.2 … (debian) $ ping 10.1.71.3 PING 10.1.71.3 (10.1.71.3) 56(84) bytes of data. 64 bytes from 10.1.71.3: icmp_seq=1 ttl=55 time=1.6 ms
Questions github.com/appc/cni github.com/coreos/rkt github.com/coreos/flannel