📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

What is a service mesh? Compare Istio (sidecar and ambient mode), Linkerd and Envoy: what mTLS, traffic shifting and observability they give a .NET platform, what they cost to run, and when you would not use one.

Covers service meshes: data plane versus control plane, Envoy as a proxy, Istio sidecar and ambient (ztunnel and waypoint) modes, Linkerd's Rust micro-proxy, automatic mTLS, retries and traffic splitting, golden-signal metrics, operational cost, and alternatives such as Container Apps or plain Kubernetes.

Mid-Level Theory Intermediate cloud-native envoy istio linkerd mtls service-mesh

🎯 Key points

  • Mesh = data plane (proxies on every hop) + control plane (config, certificates); app code unchanged
  • Envoy is the proxy; Istio uses Envoy sidecars or ambient mode (per-node ztunnel for L4 mTLS, optional waypoint for L7)
  • Linkerd: lightweight Rust micro-proxy sidecars, simpler to run, fewer L7 features
  • Automatic mTLS with workload identity (SPIFFE) and short-lived certificates rotated by the control plane
  • Traffic management: retries, timeouts, weighted canaries, fault injection; gRPC per-request load balancing
  • Golden metrics (requests, errors, latency) per edge without code changes; complements, not replaces, OpenTelemetry in the app
  • Costs: sidecar CPU/memory per pod, added latency (sub-ms to a few ms), upgrades, steep debugging
  • Skip it for a handful of services or on Container Apps; consider ambient mode or managed Istio on AKS when you need it

⏱ 30-second answer

A service mesh moves service-to-service concerns out of code into the platform. A data plane of proxies intercepts every call, and a control plane configures them and issues certificates. You get automatic mTLS with workload identity, traffic management (retries, timeouts, weighted canaries, per-request gRPC balancing) and golden metrics per edge.

  • Envoy is the proxy most meshes and gateways are built on.
  • Istio runs Envoy as sidecars, or in ambient mode with a per-node ztunnel for L4 mTLS and optional waypoint proxies for L7.
  • Linkerd uses a small Rust proxy and is simpler to run, with fewer features.

The trade-off is operational: extra latency and memory per pod, a control plane to upgrade, and harder debugging. Under roughly ten services, the platform's built-in features are usually enough.

🗣 Full answer (senior)

How I would answer this in an interview

"A service mesh puts a proxy on every network hop between services and a control plane that programs those proxies. The point is that cross-cutting network behaviour, encryption, identity, retries, traffic splitting and metrics, becomes platform configuration instead of code in every service. Envoy is the proxy underneath most of it. Istio historically injected an Envoy sidecar into each pod; its ambient mode, which went GA in Istio 1.24, replaces that with a per-node ztunnel that does mTLS at layer 4, and you add a waypoint proxy only for services that need layer 7 features like header-based routing. Linkerd takes the opposite approach: a tiny Rust micro-proxy sidecar, opinionated defaults, very little to configure.

For a .NET team the concrete wins are three. First, mTLS everywhere with short-lived certificates and no code change, which helps with zero-trust and Essential Eight conversations. Second, traffic control: I can shift 5% of traffic to a new version with a VirtualService or an HTTPRoute, and gRPC gets per-request load balancing so one HTTP/2 connection does not pin to one pod. Third, uniform request, error and latency metrics for every edge, which fills gaps for services nobody instrumented well.

The mistake I see is installing Istio for five services because it is on a reference architecture. Then you have hundreds of megabytes of sidecars, upgrades every few months, and engineers who cannot tell whether a 503 came from their code or Envoy. I also see teams double up retries in Polly and the mesh. A mesh earns its keep at scale or under a hard mTLS requirement; before that, Container Apps' built-in features or plain Kubernetes with good app telemetry are cheaper."


The options

Istio (sidecar) Istio (ambient) Linkerd Envoy alone
Data plane Envoy per pod ztunnel per node (L4) + optional waypoint (L7) Rust micro-proxy per pod You deploy and configure it
mTLS Yes Yes (ztunnel) Yes, on by default Manual
L7 routing, canaries Rich Via waypoint Basic (HTTPRoute) Rich, hand-written
Resource cost Highest Lower (no per-pod proxy) Low Depends
Operating effort High Medium-high Lower High
On AKS Istio-based service mesh add-on (managed) Check add-on support before choosing Self-installed Gateways, ingress

What you get versus what you still own

The mesh gives you You still own in the app
Transport encryption and workload identity Authorisation (app roles, policies)
Retries and timeouts per route Idempotency, so retries are safe
Edge metrics and access logs Business metrics and spans inside the service
Traffic splitting Backwards-compatible contracts between versions

Production example

On an AKS cluster with [40] .NET services, enabling the Istio add-on gave mTLS on every hop for a [Privacy Act] audit without touching code. Envoy sidecars added about [0.5-1 ms] at p50 and [60-80 MB] of memory per pod, which we accepted; we turned off mesh retries where Polly already retried.

🔍 What the interviewer is checking

Checks whether the candidate understands how a mesh works and can weigh its benefits against a real operational cost.

Green flags

  • Separates data plane and control plane, and names Envoy's role
  • Knows Istio ambient mode (ztunnel, waypoint) and Linkerd's lighter model
  • Says mTLS is not authorisation and the app still needs OpenTelemetry
  • Gives a threshold or a concrete need for adopting one

Red flags

  • "Every microservices platform needs Istio"
  • Thinks the mesh replaces resilience design or idempotency
  • Cannot name any cost beyond "complexity"

📚 Learn in depth

1. Data plane and control plane

            control plane (istiod / linkerd-destination + identity)
              |  config (xDS)     |  certificates (SPIFFE identities)
              v                   v
[orders pod: app -> proxy] ==mTLS==> [proxy -> pricing pod: app]
                    \_ metrics, access logs, traces headers _/

Traffic is redirected into the proxy by iptables rules (or eBPF/CNI) so the app keeps calling http://pricing. The proxy upgrades the hop to mTLS, applies routing and retry rules, and emits metrics.

2. Istio ambient mode

Sidecars mean one proxy per pod: memory scales with replica count, and upgrading the mesh means restarting every pod. Ambient mode splits the work:

node: [ztunnel]  <- L4: mTLS, identity, L4 authorisation, telemetry for all pods on the node
per service/namespace (optional): [waypoint Envoy] <- L7: HTTP routing, retries, header-based policy

Ambient went GA in Istio 1.24 (late 2024) and recent releases keep adding features, such as weighted waypoint canaries in 1.31. Check that your managed offering (for example the AKS Istio add-on) supports the mode before you design around it.

3. mTLS and identity

Each workload gets an X.509 certificate encoding a SPIFFE id such as spiffe://cluster.local/ns/shop/sa/orders, tied to its Kubernetes service account. Certificates are short-lived (hours) and rotated automatically. PeerAuthentication in STRICT mode rejects plaintext; AuthorizationPolicy can allow orders to call pricing only. That is coarse service-level authorisation; per-user and per-record rules stay in the app.

4. Traffic management

  • Weighted routing: 95/5 split between v1 and v2 subsets for canaries.
  • Retries and timeouts: per route; only safe for idempotent requests.
  • Fault injection: add delay or aborts to test resilience.
  • gRPC: the proxy balances per request, fixing HTTP/2 connection pinning behind ClusterIP Services.

5. Observability

Proxies report request count, error rate and latency histograms per source and destination (Prometheus), plus access logs. They can start spans, but the app must forward traceparent for traces to join, which .NET's HttpClient and OpenTelemetry already do.

6. Cost model

Cost Rough size
Sidecar memory Tens of MB per pod (Envoy usually more than Linkerd's proxy)
Latency Sub-millisecond to a few ms per hop at p99
Upgrades Control plane plus data plane, every few months to stay supported
Skills xDS, Envoy config dumps, istioctl analyze, mesh-specific CRDs

A sidecar also changes pod lifecycle: if the proxy exits before the app finishes draining on SIGTERM, in-flight outbound calls fail. Native sidecar containers in Kubernetes and ambient mode reduce that.

Try it yourself

  1. Install Linkerd on a kind cluster, inject two .NET services and run linkerd viz stat deploy to see golden metrics without code changes.
  2. Install Istio in ambient mode, label the namespace, and confirm mTLS with istioctl ztunnel-config workloads.
  3. Create a 90/10 HTTPRoute split between two versions and watch the ratio in the metrics.
  4. Measure p50/p99 latency of a call with and without the mesh using a load-test tool.
  5. Send SIGTERM to a pod during load and look for failed outbound calls caused by proxy shutdown order.

💻 Code

The .NET code does not change for a mesh; what matters is that the service propagates trace context and does not double up retries. The traffic split lives in Kubernetes config.

// Program.cs: in a mesh, keep timeouts in the app but let the mesh own retries for this client.
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetry()
    .WithTracing(t => t.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation().AddOtlpExporter());

builder.Services.AddHttpClient<PricingClient>(c =>
{
    c.BaseAddress = new Uri("http://pricing.shop.svc.cluster.local"); // plain HTTP: the mesh upgrades it to mTLS
    c.Timeout = TimeSpan.FromSeconds(3);                             // the app still bounds its own wait
});
// No AddStandardResilienceHandler here because the mesh route below retries; pick one layer.

var app = builder.Build();
app.MapGet("/quote/{sku}", async (string sku, PricingClient pricing, CancellationToken ct) =>
    Results.Ok(await pricing.GetAsync(sku, ct)));
app.Run();

public sealed class PricingClient(HttpClient http)
{
    public Task<decimal> GetAsync(string sku, CancellationToken ct) =>
        http.GetFromJsonAsync<decimal>($"/prices/{Uri.EscapeDataString(sku)}", ct);
}
# Gateway API HTTPRoute: 90/10 canary for pricing, supported by Istio and Linkerd
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata: { name: pricing, namespace: shop }
spec:
  parentRefs: [ { group: "", kind: Service, name: pricing, port: 80 } ]
  rules:
    - backendRefs:
        - { name: pricing-v1, port: 80, weight: 90 }
        - { name: pricing-v2, port: 80, weight: 10 }

⚠ Common mistakes

  • Mistake: Installing a mesh for a handful of services because a reference architecture shows one. Why it is wrong: You pay memory, latency and upgrade work for problems you do not have. Instead: Start with platform features (Container Apps, Kubernetes network policies, app-level OpenTelemetry) and adopt a mesh for a concrete need such as mandatory mTLS.
  • Mistake: Treating mesh mTLS as authorisation. Why it is wrong: It proves which workload connected, not whether this user may read this record. Instead: Keep authorisation in the app and use mesh policies for coarse service-to-service allow lists.
  • Mistake: Retrying in both Polly and the mesh. Why it is wrong: Retries multiply (3 x 3 = 9 attempts) and amplify outages. Instead: Choose one layer per call and document it.
  • Mistake: Expecting the mesh to produce full distributed traces on its own. Why it is wrong: Proxies cannot connect inbound and outbound calls unless the app forwards traceparent. Instead: Keep OpenTelemetry in the .NET service.
  • Mistake: Assuming sidecar shutdown order is handled for you. Why it is wrong: With classic sidecars (a normal second container), Kubernetes sends SIGTERM to the app and the proxy at the same time, so if the proxy finishes first, outbound calls made while the app drains fail. Raising terminationGracePeriodSeconds alone does not fix the order. Instead: Use Kubernetes native sidecar containers (an init container with restartPolicy: Always, which Kubernetes starts before and stops after the app; supported by recent Istio and Linkerd versions), or the mesh's proxy drain settings, or ambient mode, which has no per-pod proxy.
  • Mistake: Falling behind on mesh upgrades. Why it is wrong: Versions go out of support quickly and CVEs land in the proxy. Instead: Use a managed add-on where possible and schedule upgrades like any platform patching.
  • Mistake: Turning on L7 features everywhere. Why it is wrong: Every L7 hop costs CPU and latency. Instead: In ambient mode add waypoints only where you need L7 routing or policy.

🏛 Senior insight: trade-offs

A mesh is a platform-team product, not a library. The question to ask is which problem justifies it: regulatory mTLS everywhere, canary releases across dozens of services, or uniform telemetry for teams that will not instrument. If none of those is pressing, the cheaper answer is Container Apps or plain Kubernetes, managed identity tokens between services and OpenTelemetry in the app. When you do adopt one, ambient mode or a managed add-on reduces the per-pod cost and the upgrade blast radius.

The overhead grows with scale in ways teams underestimate. Sidecar memory is paid per replica, so [400] pods at [70 MB] each is about 28 GB of cluster memory, which on AKS can mean extra nodes and a visible line on the Azure bill. The control plane pushes config to every proxy, so a large mesh needs config scoping (Sidecar resources or namespace boundaries) or istiod CPU and proxy memory climb. Every incident gains a new suspect, so on-call engineers need to read Envoy access logs (response_flags such as UF or UH) and use istioctl analyze. A managed add-on, such as the Istio-based service mesh add-on for AKS, takes control-plane upgrades and certificates off your hands, but you still own data-plane restarts, the policy CRDs and the debugging skills, and you are limited to the versions and modes it supports.

Option When it fits Cost When not to
Istio sidecar Rich L7 policy, many teams, mature platform team Highest resources and complexity Small clusters, no platform team
Istio ambient Want mTLS everywhere with less overhead, L7 only for some services Newer; check managed support Need every L7 feature on every hop today
Linkerd Simple mTLS and metrics, small team Fewer features; check current licensing for stable builds Need extensive L7 routing
No mesh Under ~10 services, Container Apps You implement mTLS and identity through the platform or tokens Hard requirement for uniform mTLS and canaries

Measure the overhead in your own cluster before rolling out widely: p99 latency per hop, proxy memory and CPU per pod, node count and monthly cost, and mean time to diagnose a deliberately injected fault, before and after enabling it on one namespace.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions mTLS between services Why: Checks how mesh mTLS fits with managed identity and app-level authorisation between services.
    How to answer

    There are three styles. HTTP/JSON is universal and easy to debug; in .NET use IHttpClientFactory with AddStandardResilienceHandler for timeouts, retries and a circuit breaker. gRPC gives strict Protobuf contracts, smaller payloads, streaming and deadlines over HTTP/2, which suits high-volume internal calls, but needs layer 7 load balancing. Messaging (Azure Service Bus) removes temporal coupling: the receiver can be down or slow and the work still completes, at the cost of eventual consistency and idempotent consumers.

    I choose per interaction: if the caller needs an answer to continue, call synchronously; if it is a command or an event that can finish later, send a message. For security, each service authenticates with managed identity to get an Entra ID token the callee validates, and mTLS from a mesh or platform encrypts the hop. The trade-off: every synchronous hop multiplies latency and failure.

  2. When: Candidate mentions gRPC load balancing Why: Checks they understand the HTTP/2 connection pinning that a mesh fixes for gRPC.
    How to answer

    Treat it as three separate problems. Protocol failures ("protocol error", Unavailable, missing grpc-status) mean HTTP/2 isn't working end to end: a proxy downgrades to HTTP/1.1, drops trailers, or the endpoint isn't configured for HTTP/2 (plain-text HTTP/2 needs Http2-only endpoints; TLS needs ALPN). One pod gets all the traffic because a layer 4 load balancer pins each long-lived HTTP/2 connection to one backend; the fix is layer 7 balancing, a service mesh, or client-side round robin. DeadlineExceeded under load is usually queuing, not slowness: the 100-stream limit per connection, ThreadPool starvation, or deadlines stacked per hop instead of propagated. I diagnose with gRPC client and server logs at Debug, grpcurl from inside the network, Application Insights dependency timings and the gRPC EventCounters.

    The trade-off: long-lived HTTP/2 connections are efficient, but they move load balancing and timeouts into your design.

  3. When: Candidate mentions sidecar proxies in pods Why: Checks they know how sidecars interact with SIGTERM and connection draining.
    How to answer

    When a pod is stopped, Kubernetes removes it from Service endpoints and sends SIGTERM at the same time, then waits terminationGracePeriodSeconds (30 s by default) before SIGKILL. In .NET the Generic Host turns SIGTERM into IHostApplicationLifetime.ApplicationStopping; Kestrel stops accepting new connections and drains in-flight requests, and every IHostedService.StopAsync runs, all bounded by HostOptions.ShutdownTimeout (30 s by default since .NET 6, including .NET 10; it was 5 s before). Because endpoint removal propagates slowly, add a short preStop delay so the pod keeps serving until load balancers stop sending to it.

    On the way up, a startup probe covers slow initialisation, a readiness probe decides whether the pod gets traffic, and liveness restarts only a truly stuck process. The trade-off: longer grace periods mean safer drains but slower deploys and scale-in.

🛠 Real-world problems: how you handle them

503s during every deployment after enabling Istio sidecars
Situation
A platform of [25] .NET services on AKS enabled Istio sidecar injection to meet an mTLS requirement from a [security review].
Signals
Each rolling deployment produced a burst of [1-3%] 503 errors with `upstream connect error or disconnect/reset before headers`; app logs showed outbound `HttpRequestException` during shutdown; no errors outside deployments.
Investigation
Correlated errors with pod termination in `kubectl get events`; Envoy access logs showed the proxy exiting while the .NET app was still draining requests and calling downstream services. `istioctl proxy-config` confirmed default drain settings; the app had a 30 s `HostOptions.ShutdownTimeout`.
Resolution
Immediate: enabled `holdApplicationUntilProxyStarts` and set the proxy's termination drain duration longer than the app's shutdown, plus a short preStop sleep so endpoints were removed before draining. Real fix: moved to native sidecar containers so Kubernetes stops the proxy after the app.
Prevention
A deployment test that runs load during a rollout and fails on any 5xx, mesh settings in the platform's Helm defaults, and an SLO alert on error rate during deployments.

How to tell it (STAR)

**S:** After we turned on Istio for mTLS across [25] services, every deployment caused a short spike of 503s. **T:** I had to stop deployments hurting customers without backing out the mesh. **A:** I lined up pod termination events with Envoy access logs and saw the proxy shutting down before the .NET app finished draining. I made the proxy start before and stop after the app, added a preStop delay, and added a load test during rollouts to the pipeline. **R:** Deployment errors went from [about 2%] to [zero] over the next [30] releases, and we kept mTLS.

↩ Usually asked after

More in Optional Advanced Tools

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me