0
0
Kubernetesdevops~10 mins

Service mesh vs library-based approach in Kubernetes - Visual Side-by-Side Comparison

Choose your learning style9 modes available
Process Flow - Service mesh vs library-based approach
Start: Application Service
Direct Service Calls
Service Communication
Service Mesh Control Plane
Configuration & Policy
Shows how library-based approach integrates proxies inside app code, while service mesh uses sidecar proxies to intercept calls, enabling features via a control plane.
Execution Sample
Kubernetes
app -> library proxy -> service
app -> sidecar proxy -> service
sidecar proxy -> control plane
Shows the flow of service calls through library proxy vs sidecar proxy in service mesh.
Process Table
StepComponentActionResultNotes
1ApplicationCalls service via library proxyRequest sent directly with embedded proxy logicLibrary proxy is part of app code
2Library ProxyProcesses requestRequest forwarded to target serviceNo separate container involved
3ApplicationCalls serviceRequest sent to sidecar proxy containerIn service mesh, proxy runs separately
4Sidecar ProxyIntercepts and processes requestApplies policies, telemetry, securityTransparent to app
5Sidecar ProxyForwards request to target serviceService receives requestService unaware of proxy
6Sidecar ProxyReports metrics to control planeControl plane updates stateEnables centralized management
7Control PlaneSends config and policiesSidecar proxies update behaviorDynamic and centralized
8ApplicationReceives responseResponse returned to appSame for both approaches
9EndNo more stepsCommunication completeProcess repeats for each call
💡 Communication ends after response is received by application
Status Tracker
ComponentStartAfter Step 1After Step 3After Step 4After Step 6Final
ApplicationIdleRequest sent via library proxyRequest sent to sidecar proxyWaiting for responseWaiting for responseResponse received
Library ProxyInactiveProcessing requestN/AN/AN/AIdle
Sidecar ProxyInactiveN/AIntercepting requestApplying policiesReporting metricsIdle
Control PlaneIdleIdleIdleIdleUpdating configIdle
Key Moments - 3 Insights
Why does the sidecar proxy run as a separate container instead of inside the app?
Because the sidecar proxy is independent, it can be updated or managed without changing the app code, as shown in execution_table steps 3 and 4.
How does the library-based approach affect the application code?
The library proxy is embedded inside the app, so the app code must include proxy logic, seen in execution_table step 1.
What role does the control plane play in the service mesh?
The control plane manages configuration and policies centrally, updating sidecar proxies dynamically, as shown in steps 6 and 7.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does the sidecar proxy apply policies to the request?
AStep 2
BStep 4
CStep 6
DStep 8
💡 Hint
Check the 'Action' column for sidecar proxy activities in execution_table rows
According to variable_tracker, what is the state of the library proxy after step 1?
AIdle
BIntercepting request
CProcessing request
DReporting metrics
💡 Hint
Look at the 'Library Proxy' row under 'After Step 1' in variable_tracker
If the control plane stops sending config, which step in execution_table would be affected?
AStep 7
BStep 4
CStep 5
DStep 9
💡 Hint
Refer to the 'Control Plane' actions in execution_table step 7
Concept Snapshot
Service mesh uses sidecar proxies as separate containers to intercept service calls,
allowing centralized control and features without changing app code.
Library-based approach embeds proxy logic inside the app, requiring code changes.
Service mesh control plane manages policies and config dynamically.
Sidecar proxies report telemetry and enforce security transparently.
Library proxies handle requests directly within the app process.
Full Transcript
This visual execution compares service mesh and library-based approaches for managing service communication in Kubernetes. The library-based proxy is part of the application code and processes requests directly, requiring app changes. The service mesh uses sidecar proxies running as separate containers that intercept calls transparently, applying policies and reporting metrics to a control plane. The control plane centrally manages configuration and policies, updating sidecars dynamically. The execution table traces each step from the application sending requests through proxies to the service and back. The variable tracker shows component states changing over time. Key moments clarify why sidecars run separately, how library proxies affect app code, and the control plane's role. The quiz tests understanding of proxy actions, states, and control plane impact. This helps beginners see how service mesh adds features without modifying app code, unlike library proxies.