How Container Networking Works: Practical Explanation
183 points
1 year ago
| 8 comments
| iximiuz.com
| HN
asicsp
1 year ago
[-]
reply
FooBarWidget
1 year ago
[-]
Kubernetes pod networking really depends on the networking plugin and cloud platform. For example on AWS VPC-CNI, pods are directly attached to a network interface (on the VPC level) and directly get an IP from that — no NAT. These network interfaces don't show up on the host OS.
reply
0xcde4c3db
1 year ago
[-]
Yeah; this article seems like a pretty nice overview of how Linux network namespaces work, but my frustrations usually aren't at that level. I usually know what I want in those terms, but it seems like the container runtimes/frameworks often refuse to do it for obscure reasons, or it requires knowledge of undocumented implications.
reply
jbnorth
1 year ago
[-]
Well, more or less. The pod IPs are assigned to the host ENIs and not to pods directly. The VPC CNI manages the virtual Ethernet devices in the host and pod network namespaces and sets up routes on the host such that inbound traffic using a pod IP will get routed to the correct virtual Ethernet device for the corresponding pod.
reply
davidy123
1 year ago
[-]
This reminded me of the syndrome of descriptions of software that assume knowledge of the last system. eg "well-known Linux facilities." Pretty sure the number of people who know what network namespaces are is smaller than those fuzzily familiar with container networking.
reply
zekica
1 year ago
[-]
Great explanation but went right away with NAT, port forwarding and no mention of proper routing setup and no mention of IPv6.
reply
StrangeSmells01
1 year ago
[-]
Does anyone know if Kubernetes implements it's own networking or does it use container networking?
reply
freedomben
1 year ago
[-]
K8s defines an interface with requirements (such as every pod must be directly addressable by ip from every other pod) and you bring your own networking implementation. It's never just the standard container networking though as it needs to span horizontally.
reply
tamiral
1 year ago
[-]
Kubernetes does not use the traditional Docker networking model, but rather implements its own networking model. The Kubernetes networking model ensures that every pod gets its own IP address and allows pods to communicate with each other without NAT (Network Address Translation).
reply
dilyevsky
1 year ago
[-]
So there used to be something called "kubenet" which was built-in implementation that worked similar to what this article described, nowadays all networking is out-of-tree and handled by external networking plugins via the CNI[0].

[0] - https://cni.dev

reply
raju
1 year ago
[-]
Previous submission (with 67 comments): https://news.ycombinator.com/item?id=25834444
reply
DiggyJohnson
1 year ago
[-]
Really like this guy's writeups. Strikes a good balance between shallow beginner material and the implementation details of the source code.
reply
mistermegabyte
1 year ago
[-]
Dang, I thought this was gonna be an article about shipping container logistics and moving products around the world. Still interesting, though.
reply
mighmi
1 year ago
[-]
There's a very nice book The Box by Leninson about Shopping Containers, their history and economic impact!
reply