A Complete Guide to Kubernetes Networking: From CNI Principles to Istio/Linkerd Adoption Strategy
Kubernetes is the backbone of modern cloud-native architecture. The same system that deploys and manages countless microservices as containers is just as famous for its networking black box. Answering “When service A calls service B, what exact path and rules does the traffic follow internally?” is the heart of Kubernetes networking.
This guide goes beyond the service names you see with kubectl get svc. It covers container-to-container communication and the front line of traffic control—service mesh adoption strategy—in the depth infrastructure architects and DevOps engineers actually need.
Kubernetes Networking Basics: Pod IP vs. Service IP
To understand service communication in Kubernetes, you need to clearly distinguish three address concepts.
- Pod IP (the real communication address): Each Pod is assigned a unique IP address within the cluster. This is the lowest-level destination where traffic actually lands.
- Service IP (the abstracted address): This is the address your application code calls. A Service acts as a virtual IP that load-balances across multiple Pods.
- ClusterIP: A stable internal IP that makes a Service reachable from inside the cluster. It is not accessible from outside.
Thanks to this abstraction, developers can talk to a stable name like my-service:8080 without caring that Pod IPs change.
CNI: Designer and Executor of the Network
So who actually assigns IPs and sets up routing? That’s CNI (Container Network Interface).
CNI is not Kubernetes itself. It sits between the container runtime (e.g., Containerd) and the Kubernetes control plane and acts as a network plugin. On each node, CNI does the following:
- IP assignment: When a Pod is created, the CNI plugin assigns it a valid IP address.
- Network policy enforcement: It applies allow/deny rules based on Network Policy.
- Routing configuration: It programs node-level routing tables so the Pod can talk to other Pods in the cluster.
💡 CNI data path (conceptual flow):
[External request] $\rightarrow$ [Kube-proxy/CNI on Node A] $\rightarrow$ [Service IP (Virtual)] $\rightarrow$ [Routing rules programmed by CNI] $\rightarrow$ [Actual Pod IP (Node B)] $\rightarrow$ [Pod application]
Think of it as a carefully engineered road network. CNI draws the map and installs the traffic lights.
Why You Need a Service Mesh: Taking Service Communication to the Next Level
Basic Kubernetes networking guarantees connectivity. In other words, A can reach B. In modern microservice environments, connectivity alone is not enough.
You typically face requirements like these:
- Observability: You need to know which requests failed, why they failed, and where the bottleneck is—without changing application code.
- Traffic control: You want a new version (v2) to receive only 10% of traffic, and to roll back immediately if something goes wrong (Canary Deployment).
- Security: All service-to-service traffic should be encrypted (mTLS).
Implementing this traffic-control logic in application code (Java, Python, etc.) is a disaster. It pollutes business logic, and you have to reimplement it for every language.
A Service Mesh exists to solve this. It intercepts the communication layer between services (via a sidecar proxy) and moves networking, security, and observability logic into the platform layer.
Understanding the Sidecar Pattern and L4 vs. L7 Control
The core implementation of a service mesh is the sidecar pattern. You attach a separate proxy container (the sidecar) next to each application Pod so that all inbound and outbound traffic goes through that proxy.
That architecture lets you control traffic at both L4 (transport) and L7 (application).
| Category | L4 (TCP/UDP) | L7 (HTTP/HTTPS) |
|---|---|---|
| What you control | IP addresses and port numbers | HTTP methods, headers, URI paths |
| What you can do | Allow or deny connections to a given port | Allow only GET requests to /api/v2/users |
| Service mesh use | Basic connectivity control | Canary releases, A/B tests, header-based routing |
Because the sidecar proxy can read L7 HTTP headers, you can do things like “send requests with this header to backend A, and everything else to backend B.”
Head-to-Head: Istio vs. Linkerd
The two leading service mesh solutions today are Istio and Linkerd.
- Istio: The most feature-rich option. It offers strong policy control (Authorization Policy) and sophisticated traffic management (VirtualService). The learning curve is steep, but it covers the widest range of scenarios.
- Linkerd: Lightweight and easy to operate. It focuses less on complex traffic management and more on reliable service discovery and automatic metrics collection.
Conclusion: When to Use What
- Simple communication and reliability: Linkerd is often the better fit.
- Complex traffic splitting and policy control: Istio is the stronger option.
💡 Quick recap:
| Concept | Role | Key technology |
|---|---|---|
| Service Mesh | Abstracts the communication layer between microservices and centralizes its management. | Sidecar Proxy (Envoy, etc.) |
| L4/L7 load balancing | L4 distributes by IP/port; L7 distributes by HTTP headers/URL. | Istio/Linkerd VirtualService |
| Benefits of a service mesh | mTLS, traffic control, and observability (metrics) at the infrastructure layer, not in application code. | Sidecar Injection |
Nodelog는 모든 콘텐츠의 내용과 출처를 공개 전에 검토합니다. 환경(OS·버전)에 따라 결과가 달라질 수 있는 기술 정보는 공식 문서와 함께 확인하며, 검토 기준과 정정 원칙은 편집 정책에서 안내합니다. 오류를 발견하시면 이메일로 제보해 주세요 — 확인 후 신속히 정정합니다.
Comments
Be the first to comment.