Home » Container Networking: Docker, Kubernetes CNI, Calico, Cilium และ Service Mesh
Container Networking: Docker, Kubernetes CNI, Calico, Cilium และ Service Mesh
Container Networking: Docker, Kubernetes CNI, Calico, Cilium และ Service Mesh
Container Networking เป็นพื้นฐานของ cloud-native infrastructure Docker networking ให้ containers สื่อสารกันบน single host, Kubernetes CNI (Container Network Interface) เป็น standard plugin สำหรับ pod networking, Calico ให้ L3 networking + network policy, Cilium ใช้ eBPF สำหรับ high-performance networking + observability และ Service Mesh (Istio, Linkerd) ให้ advanced traffic management ระหว่าง microservices
Container environments มี networking challenges ที่ต่างจาก traditional VMs: containers สร้าง/ทำลายทุกวินาที, IP addresses เปลี่ยนตลอด, ต้อง service discovery, ต้อง load balancing, ต้อง network policies สำหรับ microsegmentation Container networking tools แก้ปัญหาเหล่านี้โดยอัตโนมัติ
Docker Networking
| Driver |
Scope |
Use Case |
| bridge (default) |
Single host |
Containers บน host เดียวกัน communicate ผ่าน virtual bridge (docker0) |
| host |
Single host |
Container ใช้ host’s network stack โดยตรง (no isolation, best performance) |
| none |
Single host |
No networking (isolated container) |
| overlay |
Multi-host |
Containers ข้าม hosts communicate (Docker Swarm, VXLAN encapsulation) |
| macvlan |
Single host |
Container ได้ MAC address บน physical network (appear as physical device) |
| ipvlan |
Single host |
เหมือน macvlan แต่ share MAC address (L2/L3 mode) |
Kubernetes Networking Model
| Requirement |
รายละเอียด |
| Pod-to-Pod |
ทุก pod สื่อสารกับทุก pod ได้โดยไม่ต้อง NAT (flat network) |
| Node-to-Pod |
ทุก node สื่อสารกับทุก pod ได้โดยไม่ต้อง NAT |
| Pod IP = Real IP |
IP ที่ pod เห็นตัวเอง = IP ที่คนอื่นเห็น (no NAT translation) |
| CNI Plugin |
Implementation ของ networking model (Calico, Cilium, Flannel, etc.) |
Kubernetes Service Types
| Type |
Access |
How |
| ClusterIP (default) |
Internal only |
Virtual IP inside cluster → load balance to pods |
| NodePort |
External via node IP:port |
Expose service on each node’s IP at static port (30000-32767) |
| LoadBalancer |
External via cloud LB |
Cloud provider creates external LB → routes to NodePort |
| ExternalName |
DNS alias |
Maps service to external DNS name (CNAME) |
| Ingress |
HTTP/HTTPS routing |
L7 load balancer (host/path-based routing, TLS termination) |
CNI Plugins Comparison
| Feature |
Calico |
Cilium |
Flannel |
Weave Net |
| Dataplane |
iptables / eBPF |
eBPF |
VXLAN / host-gw |
VXLAN / sleeve |
| Network Policy |
Full (L3-L4 + L7 with Istio) |
Full (L3-L4-L7 native) |
None (basic only) |
Basic |
| Performance |
High (BGP / eBPF mode) |
Highest (eBPF, bypass iptables) |
Good |
Moderate |
| Encryption |
WireGuard |
WireGuard / IPsec |
IPsec (optional) |
IPsec (built-in) |
| Observability |
Basic (flow logs) |
Advanced (Hubble — flow visibility) |
Minimal |
Basic |
| BGP |
Native BGP support |
BGP (via MetalLB integration) |
No |
No |
| Complexity |
Medium |
Medium-High |
Low (simplest) |
Low |
| Best For |
Enterprise, hybrid |
Performance, security, observability |
Simple clusters |
Small clusters |
Calico
| Feature |
รายละเอียด |
| คืออะไร |
L3 networking + network policy engine สำหรับ Kubernetes |
| Routing |
BGP peering ระหว่าง nodes (pure L3 — no overlay needed) |
| Overlay Mode |
VXLAN หรือ IP-in-IP สำหรับ networks ที่ไม่ support BGP |
| Network Policy |
Kubernetes NetworkPolicy + Calico GlobalNetworkPolicy (more powerful) |
| eBPF Mode |
Bypass iptables → better performance (optional) |
| WireGuard |
Encrypt pod-to-pod traffic ด้วย WireGuard (transparent) |
Cilium
| Feature |
รายละเอียด |
| คืออะไร |
eBPF-based networking, security, and observability สำหรับ Kubernetes |
| eBPF |
Run programs ใน Linux kernel → bypass iptables entirely → fastest dataplane |
| L7 Policy |
Network policies ที่ L7 (HTTP method, path, headers, gRPC, Kafka topics) |
| Hubble |
Network observability platform (flow visualization, service map, DNS monitoring) |
| Service Mesh |
Cilium Service Mesh (sidecar-free — eBPF-based, no Envoy proxy needed) |
| Cluster Mesh |
Connect multiple Kubernetes clusters (multi-cluster networking) |
| Tetragon |
Runtime security (eBPF-based process monitoring, file access, network) |
Service Mesh
| Feature |
Istio |
Linkerd |
Cilium Service Mesh |
| Proxy |
Envoy sidecar |
Linkerd2-proxy (Rust, lightweight) |
eBPF (no sidecar) |
| mTLS |
Automatic mTLS |
Automatic mTLS |
WireGuard/IPsec |
| Traffic Management |
Advanced (canary, mirror, fault injection) |
Basic (traffic split) |
Basic |
| Observability |
Kiali, Jaeger, Prometheus |
Linkerd dashboard, Prometheus |
Hubble |
| Complexity |
High (many components) |
Low (simple, lightweight) |
Low (no sidecars) |
| Performance |
Overhead (sidecar per pod) |
Low overhead (Rust proxy) |
Lowest (kernel-level eBPF) |
Network Policy
| Policy Type |
Scope |
Example |
| Kubernetes NetworkPolicy |
L3-L4 (IP, port, protocol) |
Allow traffic from frontend pods to backend pods on port 8080 |
| Calico GlobalNetworkPolicy |
L3-L4 + cluster-wide |
Deny all egress except DNS (53) for entire namespace |
| Cilium CiliumNetworkPolicy |
L3-L4-L7 |
Allow only GET /api/v1/users from frontend to backend (L7 HTTP policy) |
ทิ้งท้าย: Container Networking = Foundation of Cloud-Native
Container Networking Docker: bridge (single host), overlay (multi-host), host, macvlan Kubernetes: flat network model (pod-to-pod without NAT) + CNI plugins Services: ClusterIP (internal), NodePort, LoadBalancer, Ingress (L7) CNI: Calico (BGP + policy), Cilium (eBPF + L7 policy + Hubble), Flannel (simple) Service Mesh: Istio (Envoy sidecar), Linkerd (lightweight), Cilium (sidecar-free eBPF) Network Policy: microsegmentation at L3-L4 (K8s native) or L7 (Cilium) Trend: eBPF replacing iptables → faster, more observable, more secure
อ่านเพิ่มเติมเกี่ยวกับ Cloud Networking AWS VPC Azure VNet และ Network Virtualization NFV VNF ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com