Istio
hard 29 minIstio 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
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
May 2017
Google, IBM and Lyft announce Istio 0.1, built on Lyft's Envoy proxy.
July 2018
Istio 1.0 is declared ready for production.
March 2020
Istio 1.5 joins the control plane parts into one program, istiod.
September 2022
Istio is accepted into the CNCF as an incubating project. It graduates in July 2023.
November 2024
Istio 1.24 makes ambient mode generally available and removes the default retry of 503 answers.
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.
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?
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
What istiod does
| Job | How |
|---|---|
| Discovery | Watches Kubernetes for services and endpoints |
| Configuration | Turns high-level rules into Envoy configuration and streams changes (xDS) |
| Certificates | Is the certificate authority: checks a workload's service account token and signs its request |
| Injection | Adds the sidecar to new pods through a webhook |
A rule travels to the proxies
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
Two data planes
| Sidecar | Ambient | |
|---|---|---|
| Proxy | One Envoy in every pod | One ztunnel per node, waypoints where needed |
| Joining the mesh | Label the namespace and restart pods | Label the namespace; no restart |
| Layer 7 features | Always, processed on both sides | Only with a waypoint, processed once |
| Added latency, p90 to p99 (Istio's test) | 0.63 to 0.88 ms | 0.16 to 0.20 ms; with waypoint 0.40 to 0.50 ms |
| Keys | Each workload holds its own | The node's ztunnel holds keys of its workloads |
| Upgrade | Restart application pods | Replace ztunnel and waypoints |
| Virtual machines | Supported | Not listed as a platform; Kubernetes only |
| Several clusters | Stable | Younger: check the state of your version |
What the proxies cost
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.
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: 10How a request is matched
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
| Setting | Default | Meaning |
|---|---|---|
| HTTP timeout | Off | A slow service can hold callers for as long as it likes |
| Retries | 2 attempts | Up to 3 requests in all, 25 ms or more between them |
| Retried on | connect-failure, refused-stream, unavailable, cancelled | Not on 503 since 1.24 |
| Outlier detection | Off until you set it | Then: 5 errors in a row, check every 10 s, out for 30 s, at most 10% of hosts |
| Outbound traffic | Allowed to unknown hosts | A typo or a leak goes straight to the internet |
| mTLS mode | Permissive | Plain text from outside the mesh is accepted |
Retries multiply
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: 30A 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
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"]targetRefs.Order of decisions
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
| Failure | Effect | Preparation |
|---|---|---|
| istiod is down | Traffic continues. No new rules; new pods wait for configuration; certificates are not renewed | Two or more replicas, alerts well before expiry |
| A sidecar is down | Its pod is cut off | Readiness, resource requests for the proxy |
| ztunnel of a node is down | All mesh pods on that node are affected | Node is the failure domain: spread replicas |
| Waypoint is down | Layer 7 traffic to its services stops | Several replicas, autoscaling |
| Wrong rule | Immediate, everywhere | istioctl analyze, small scope, staged rollout |
| Webhook down | New pods may start without a sidecar or not at all | Know the failure policy; strict mTLS exposes it |
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-0Operations
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
| Product | Alike | Different |
|---|---|---|
| Linkerd | mTLS, retries, metrics, splits | Own small Rust proxy, sidecars only, fewer settings |
| Envoy | The proxy inside Istio | A proxy, not a mesh: you write or generate its configuration |
| Consul | Discovery and mesh | Its own registry, also strong outside Kubernetes |
| Cilium | Encryption, policy | Network layer with eBPF; layer 7 through a shared Envoy |
| API gateway | Routes, limits, tokens | For clients outside, not between services |
| Cloud Service Mesh | Istio APIs | Google 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.