AlgoViz

Istio

hard 29 min

Istio is a service mesh: proxies beside or below your services carry every call, and one control plane, istiod, gives them routes, limits, identities and access rules.

Video lesson · Chapter 1 of 5

Change where a museum sells its tickets

0:00 / 4:11

Istio in 90 seconds

1:30Reel coming soon

Theory

Read or listen first. About 2 min.

What it is

A service mesh is a layer that handles calls between services without changes to their code. Istio is one of the best known: open source under the Apache License 2.0, and a graduated project of the Cloud Native Computing Foundation.

It has two parts. The data plane is made of proxies that carry the traffic. The control plane, a program called istiod, watches the cluster and your rules, and sends each proxy its configuration and certificates.

There are two kinds of data plane. In sidecar mode every pod gets its own Envoy proxy. In ambient mode every node gets a small layer 4 proxy called ztunnel, and only services that need layer 7 features go through an Envoy proxy called a waypoint.

Why it exists

With microservices, every call needs timeouts, retries, encryption, identity and metrics. Writing that in every language gives as many versions as teams, and a change takes months.

A mesh does it once. The platform team can demand encryption everywhere, a team can send 5% of traffic to a new version, and an operator sees request rates and errors for every pair of services.

A short history

  1. May 2017

    Google, IBM and Lyft announce Istio 0.1, built on Lyft's Envoy proxy.

  2. July 2018

    Istio 1.0 is declared ready for production.

  3. March 2020

    Istio 1.5 joins the control plane parts into one program, istiod.

  4. September 2022

    Istio is accepted into the CNCF as an incubating project. It graduates in July 2023.

  5. November 2024

    Istio 1.24 makes ambient mode generally available and removes the default retry of 503 answers.

  6. November 2026

    Istio 1.32 is released. 1.31 and 1.30 are still supported; 1.30 ends in mid December.

Words to know

Sidecar
A proxy container inside the pod, beside the application.
ztunnel
The per-node layer 4 proxy of ambient mode, written in Rust.
Waypoint
An Envoy deployment that gives layer 7 features to a namespace or service in ambient mode.
istiod
The control plane: discovery, configuration and certificates.
mTLS
TLS in which both sides prove who they are.
SPIFFE identity
A name for a workload, made from its trust domain, namespace and service account.
VirtualService
Istio's own routing rule: matches, weights, timeouts, retries, faults.
HTTPRoute
The routing rule of the Kubernetes Gateway API, which Istio also understands.
DestinationRule
Settings for a destination: subsets, balancing, connection pools, outlier detection.
AuthorizationPolicy
Who may call what.

How it works

Step through the idea, or press Play.

Step 1 of 3

Declare. Rules are Kubernetes resources

Understand it

Start here

A doorkeeper at every house

Imagine a town where messengers run between houses all day. Every household checks visitors in its own way, or not at all. How could the town change that without teaching every household?

The town and its doorkeepers
ABCOpen doors, no checks

Doorkeepers do the work. The town hall only writes the rules.

The idea

What it gives a system

  • Encryption and identity

    mTLS between workloads, with short-lived certificates tied to service accounts.

  • Access rules

    Who may call which service, method or path, written once and enforced at the destination.

  • Traffic control

    Routes by header, weighted splits, mirroring, timeouts, retries, injected faults.

  • Resilience

    Connection limits and outlier detection, the mesh's circuit breaker.

  • Telemetry

    Request rates, errors and latency for every pair of services.

  • Gateways

    The same rules for traffic entering and leaving the cluster.

The patterns have their own pages: service discovery, retries, timeouts, Kubernetes load balancing. This page is about how Istio does them, on Kubernetes.

Inside

Control plane and data plane

Sidecar mode

Two pods in a cluster, each with an application and an Envoy sidecar. The application in pod A calls through its sidecar, over mutual TLS, to the sidecar of pod B and then to the application there. istiod sends rules to both sidecars with dashed arrows.
Requests never pass through istiod. It only programs the proxies.

What istiod does

JobHow
DiscoveryWatches Kubernetes for services and endpoints
ConfigurationTurns high-level rules into Envoy configuration and streams changes (xDS)
CertificatesIs the certificate authority: checks a workload's service account token and signs its request
InjectionAdds the sidecar to new pods through a webhook

A rule travels to the proxies

This is eventually consistent: for a short time some proxies have the old rule.

When a workload starts, its Istio agent creates a private key, sends a signing request with the service account token, and gets a certificate. It renews it before it expires. The key is not shared between pods in sidecar mode.

Modes

Sidecar or ambient

Ambient mode with a waypoint

Node one holds pod A and a ztunnel, node two holds pod B and a ztunnel. Pod A's traffic goes to its node's ztunnel, through an encrypted tunnel to a waypoint proxy, on to the ztunnel of node two and into pod B.
Without a waypoint the two ztunnels talk to each other directly. The tunnel is called HBONE.

Two data planes

SidecarAmbient
ProxyOne Envoy in every podOne ztunnel per node, waypoints where needed
Joining the meshLabel the namespace and restart podsLabel the namespace; no restart
Layer 7 featuresAlways, processed on both sidesOnly with a waypoint, processed once
Added latency, p90 to p99 (Istio's test)0.63 to 0.88 ms0.16 to 0.20 ms; with waypoint 0.40 to 0.50 ms
KeysEach workload holds its ownThe node's ztunnel holds keys of its workloads
UpgradeRestart application podsReplace ztunnel and waypoints
Virtual machinesSupportedNot listed as a platform; Kubernetes only
Several clustersStableYounger: check the state of your version
The latencies are from the project's comparison page and its test hardware. Measure your own. The two modes can live in one mesh.

What the proxies cost

300 pods×60 MB=18 GB10 nodes×12 MB+6×60 MB=480 MB300\ \text{pods} \times 60\ \text{MB} = 18\ \text{GB} \qquad 10\ \text{nodes} \times 12\ \text{MB} + 6 \times 60\ \text{MB} = 480\ \text{MB}
Sidecars against ambient with six waypoint replicas, using the memory Istio published for version 1.24 at 1,000 requests a second. Large meshes need more, because proxies hold configuration.

Traffic

Routes and splits

Two sets of resources do this. The Gateway API (HTTPRoute) is the Kubernetes standard and the natural choice for new work and ambient mode. VirtualService and DestinationRule are Istio's own and can do more, such as fault injection. Do not mix both for the same service: in ambient mode that is not supported.

YAML
apiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata:  name: reviews  namespace: shopspec:  parentRefs:    - group: ""      kind: Service      name: reviews      port: 9080  rules:    - matches:        - headers:            - name: x-tester              value: "yes"      backendRefs:        - name: reviews-v2          port: 9080    - backendRefs:        - name: reviews-v1          port: 9080          weight: 90        - name: reviews-v2          port: 9080          weight: 10
Testers always get v2; everyone else goes 90 to 10. Weighted choice is per request, so one user may see both. Use a header if that matters.

How a request is matched

For a VirtualService, rules are tried in order. Always end with a rule without conditions.

Between endpoints of one destination Istio uses least requests by default. Consistent hashing gives soft stickiness by header or cookie, and locality settings prefer the same zone. Balancing is per request, which fixes the gRPC problem of one long connection to one pod.

Resilience

Timeouts, retries, outliers

Defaults that surprise

SettingDefaultMeaning
HTTP timeoutOffA slow service can hold callers for as long as it likes
Retries2 attemptsUp to 3 requests in all, 25 ms or more between them
Retried onconnect-failure, refused-stream, unavailable, cancelledNot on 503 since 1.24
Outlier detectionOff until you set itThen: 5 errors in a row, check every 10 s, out for 30 s, at most 10% of hosts
Outbound trafficAllowed to unknown hostsA typo or a leak goes straight to the internet
mTLS modePermissivePlain text from outside the mesh is accepted
From the reference pages, November 2026.

Retries multiply

(1+2)3=27(1 + 2)^{3} = 27
Three services in a row, each call tried up to three times: one click can become 27 calls to the last one. Retry at one layer, and only what is safe to repeat.
YAML
apiVersion: networking.istio.io/v1kind: VirtualServicemetadata:  name: ratings  namespace: shopspec:  hosts: [ratings]  http:    - timeout: 2s      retries:        attempts: 1        perTryTimeout: 800ms        retryOn: connect-failure,refused-stream      route:        - destination:            host: ratings---apiVersion: networking.istio.io/v1kind: DestinationRulemetadata:  name: ratings  namespace: shopspec:  host: ratings  trafficPolicy:    connectionPool:      http:        http1MaxPendingRequests: 100        http2MaxRequests: 200    outlierDetection:      consecutive5xxErrors: 5      interval: 10s      baseEjectionTime: 30s      maxEjectionPercent: 30
Outlier detection works per calling proxy: each learns on its own which endpoint is bad.

A retry of a POST is only safe if the service is idempotent. Connection limits answer overload at once with 503 instead of queueing.

Security

Identity, mTLS and rules

One call with mTLS and a rule

The last step inside the pod is plain text, on the loopback interface.
YAML
apiVersion: security.istio.io/v1kind: PeerAuthenticationmetadata:  name: default  namespace: shopspec:  mtls:    mode: STRICT---apiVersion: security.istio.io/v1kind: AuthorizationPolicymetadata:  name: orders  namespace: shopspec:  selector:    matchLabels:      app: orders  action: ALLOW  rules:    - from:        - source:            principals: ["cluster.local/ns/shop/sa/web"]      to:        - operation:            methods: ["GET"]
Sidecar form. In ambient mode a rule with methods must be attached to a waypoint with targetRefs.

Order of decisions

The first ALLOW policy turns the workload into deny by default. Without any, everything is allowed.

Steps to strict: install in permissive mode, watch which traffic is still plain, bring those callers into the mesh, switch one namespace to STRICT, then the next. Rules that use identity need mTLS: plain text has none.

Telemetry

Seeing every call

Layer 7 proxies report requests, errors and durations with source and destination as labels, and can take part in traces. They cannot join the pieces of a trace: applications must pass on the trace headers they receive. ztunnel alone gives layer 4 data: connections and bytes. Labels with many values fill monitoring storage quickly, so choose them.

Failure

What breaks how

FailureEffectPreparation
istiod is downTraffic continues. No new rules; new pods wait for configuration; certificates are not renewedTwo or more replicas, alerts well before expiry
A sidecar is downIts pod is cut offReadiness, resource requests for the proxy
ztunnel of a node is downAll mesh pods on that node are affectedNode is the failure domain: spread replicas
Waypoint is downLayer 7 traffic to its services stopsSeveral replicas, autoscaling
Wrong ruleImmediate, everywhereistioctl analyze, small scope, staged rollout
Webhook downNew pods may start without a sidecar or not at allKnow the failure policy; strict mTLS exposes it
Shell
istioctl install --set profile=ambient        # or the default profile for sidecarsistioctl analyze --all-namespaces             # find broken rules before users doistioctl proxy-status                         # are the proxies in step with istiod?istioctl ztunnel-config workloads             # what does ztunnel know?kubectl label namespace shop istio.io/dataplane-mode=ambientistioctl waypoint apply -n shop --enroll-namespace# Upgrade with a second control planeistioctl install --set revision=1-32-0
Dots are not allowed in a revision name, so 1.32.0 becomes 1-32-0.

Operations

Versions and upgrades

A minor release comes about once a quarter and is supported until six weeks after the second next one, so roughly eight months. The control plane may be one minor version ahead of the proxies, never behind. With revisions two control planes run side by side and namespaces move one by one; this also allows a jump over one minor version. In sidecar mode every move means restarting pods.

In large clusters, limit what each proxy must know (the Sidecar resource in sidecar mode): by default a sidecar learns about every service, and every change is pushed to every proxy.

Decide

When to choose it, and when not

Choose Istio when

  • Many services in several languages need the same security
  • You must prove encryption and identity between workloads
  • You need rich routing: headers, weights, mirrors, faults
  • A platform team will run it
  • Several clusters must be one mesh

Look elsewhere when

  • You have a handful of services: a library and a gateway do
  • Nobody can own upgrades every few months
  • You only want mTLS and metrics with little to learn: compare Linkerd
  • Your problem is the edge only: use a gateway
  • Traffic is mostly databases and queues, which need little of layer 7

Neighbours

ProductAlikeDifferent
LinkerdmTLS, retries, metrics, splitsOwn small Rust proxy, sidecars only, fewer settings
EnvoyThe proxy inside IstioA proxy, not a mesh: you write or generate its configuration
ConsulDiscovery and meshIts own registry, also strong outside Kubernetes
CiliumEncryption, policyNetwork layer with eBPF; layer 7 through a shared Envoy
API gatewayRoutes, limits, tokensFor clients outside, not between services
Cloud Service MeshIstio APIsGoogle runs the control plane for you

Summary

The whole topic in one minute.

Istio puts proxies on the path of every call and one control plane behind them. Proxies keep working with their last configuration when istiod is down; new pods, new rules and new certificates must wait.

Start with one need, often encryption and identity. Ambient mode gives that for little cost; add waypoints where you need layer 7. Set timeouts yourself, keep retries in one layer, and move from permissive to strict step by step.

  • Proxies carry traffic; istiod only writes the rules.
  • Sidecar: one Envoy per pod. Ambient: ztunnel per node, waypoints for layer 7.
  • No default timeout, two default retries, permissive mTLS.
  • CUSTOM, then DENY, then ALLOW; the first ALLOW closes the door for others.
  • Upgrades come every few months: plan revisions and owners.

Sources