Containers

Install Istio on Kubernetes: mTLS, Canary and Traffic Routing

A plaintext client calling a namespace under STRICT mTLS doesn’t get an error page or a 403. It gets Connection reset by peer and curl exit code 56, which looks exactly like a network fault until you know what Istio is doing. That reset is the most useful thing this guide shows you, because it’s the first thing that breaks when a team turns mTLS on for real.

Original content from computingforgeeks.com - post 167283

We install Istio with istioctl, run sidecar injection and ambient mode side by side, enforce STRICT PeerAuthentication, fix the client it locks out, and split traffic between two podinfo versions with a VirtualService and DestinationRule. Every split count, latency figure and istioctl analyze warning below came from a two-node kubeadm cluster running Kubernetes 1.37 and Istio 1.32 on Ubuntu 26.04. We captured them on 29 November 2026, and the guide was updated in December 2026.

Understand what the lab builds

Istio gives every workload a SPIFFE identity, encrypts pod to pod traffic with mutual TLS, and moves routing decisions such as weights and header matches out of your app and into Envoy. The lab below puts all of that in one cluster so you can see each piece work and fail.

Istio architecture diagram: ingress gateway at 10.0.1.200 splitting podinfo traffic 90/10, STRICT mTLS rejecting a plaintext legacy client, and an ambient namespace using ztunnel HBONE on port 15008

Four namespaces do the work, and each one tests a different part of the mesh:

  • istio-system: istiod and the ingress gateway on 10.0.1.200
  • demo: podinfo v1 and v2 with sidecars, STRICT mTLS
  • legacy: a curl client with no proxy
  • demo-ambient: podinfo and a client through ztunnel, STRICT mTLS

Keeping the plaintext client in its own namespace matters, because it lets you flip injection on and off for the caller without touching the service it calls.

Check the cluster before installing

Istio needs a working cluster with a CNI, and the ingress gateway needs something that hands out LoadBalancer IPs. Our lab used these components, and the same steps work on any conformant cluster:

  • Kubernetes 1.37.3 from kubeadm, one control plane and one worker
  • containerd 2.2.2 on Ubuntu 26.04.1 LTS
  • Calico 3.33.1 as the CNI
  • MetalLB 0.16.2 with the pool 10.0.1.200 to 10.0.1.210
  • metrics-server, so kubectl top works
  • jq on the machine that runs the curl loops

Each node had 4 vCPUs and 16 GB of RAM, which is a comfortable floor for a lab. Production sizing depends on pod count and request rate, since each sidecar adds roughly 30 MiB. If you’re starting from bare VMs, our kubeadm cluster on Ubuntu 26.04 guide gets you here, and the MetalLB setup covers the address pool. Confirm the nodes are Ready first:

kubectl get nodes -o wide

Both nodes should report Ready. Ours ran v1.37.3 on containerd 2.2.2, and a node stuck in NotReady at this point is almost always a CNI problem, so fix it before Istio adds its own CNI plugin on top.

NAME           STATUS   ROLES           AGE     VERSION   INTERNAL-IP     EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION           CONTAINER-RUNTIME
k8s-cp01       Ready    control-plane   2m16s   v1.37.3   10.132.15.195   <none>        Ubuntu 26.04.1 LTS   7.0.0-1018-gcp (amd64)   containerd://2.2.2
k8s-worker01   Ready    <none>          2m      v1.37.3   10.132.15.196   <none>        Ubuntu 26.04.1 LTS   7.0.0-1018-gcp (amd64)   containerd://2.2.2

Running Cilium instead of Calico? The steps do not change, but read the Cilium production guide first, because Cilium’s own kube-proxy replacement and Istio’s CNI plugin need a few settings to coexist.

Download istioctl

Istio’s download script detects your OS and architecture and fetches the latest release, so you never hardcode a version. Run it from your home directory on the machine that holds your kubeconfig:

curl -L https://istio.io/downloadIstio | sh -

Watch the last lines of its output. The script unpacks into a versioned directory and names it, which tells you exactly which release you just pulled.

Downloading istio-1.32.0 from https://github.com/istio/istio/releases/download/1.32.0/istio-1.32.0-linux-amd64.tar.gz ...

Istio 1.32.0 download complete!

The Istio release archive has been downloaded to the istio-1.32.0 directory.

Move the binary onto your PATH and let istioctl check the cluster before it touches anything. Keep the istio-1.32.0 directory, because the Kiali and Prometheus manifests used later live in its samples/ folder.

cd istio-* && sudo mv bin/istioctl /usr/local/bin/ && cd ~
istioctl x precheck

Precheck reads the cluster version, your permissions and any existing Istio install. On a clean cluster it prints a green check and a getting started link, and on a cluster with an older control plane it warns before you overwrite anything.

✔ No issues found when checking the cluster. Istio is safe to install or upgrade!
  To get started, check out https://istio.io/latest/docs/setup/getting-started/.

What changed in this release is listed in the Istio 1.32 announcement. Read it before upgrading an existing mesh, not just before a fresh install.

Install Istio with the ambient profile

Istio’s ambient profile installs istiod, the istio-cni node agent and ztunnel, but no ingress gateway. Adding the gateway with two --set flags gives you one control plane that serves sidecar namespaces and ambient namespaces at the same time, which is how we compare them later. Quote the [0] keys so zsh doesn’t treat them as globs:

istioctl install --set profile=ambient --set 'components.ingressGateways[0].enabled=true' --set 'components.ingressGateways[0].name=istio-ingressgateway' -y

It finished in 16.7 seconds. The pods, the gateway’s external IP and the version check all came back in under a minute.

istioctl install with the ambient profile and an ingress gateway, showing istiod, istio-cni, ztunnel and the gateway LoadBalancer IP 10.0.1.200

You should see one istiod, one istio-cni-node and one ztunnel per node, and an ingress gateway Service of type LoadBalancer holding 10.0.1.200 from the MetalLB pool. If EXTERNAL-IP stays at <pending>, MetalLB has no pool or no L2Advertisement, and nothing Istio does will fix that. Save the address for the routing tests:

export INGRESS_LB_IP=$(kubectl -n istio-system get svc istio-ingressgateway -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
echo $INGRESS_LB_IP

The echo prints 10.0.1.200 in our lab. Yours will be the first free address in your own pool, and if the variable comes back empty, every curl later in this guide fails with a confusing URL error, so check it now.

Run istioctl analyze on the fresh install

Run the analyzer once before you deploy anything, so you know which messages were there from the start. Otherwise you’ll chase them later as if your config caused them.

istioctl analyze --all-namespaces

Our cluster returned only Info level messages. There were no warnings and no errors, which is what a healthy install looks like.

Info [IST0102] (Namespace calico-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace calico-system istio-injection=enabled' to enable it, or 'kubectl label namespace calico-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace default) The namespace is not enabled for Istio injection. Run 'kubectl label namespace default istio-injection=enabled' to enable it, or 'kubectl label namespace default istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace metallb-system) The namespace is not enabled for Istio injection. Run 'kubectl label namespace metallb-system istio-injection=enabled' to enable it, or 'kubectl label namespace metallb-system istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0102] (Namespace tigera-operator) The namespace is not enabled for Istio injection. Run 'kubectl label namespace tigera-operator istio-injection=enabled' to enable it, or 'kubectl label namespace tigera-operator istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0118] (Service calico-system/calico-kube-controllers-metrics) Port name metrics-port (port: 9094, targetPort: 9094) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service calico-system/calico-typha) Port name calico-typha (port: 5473, targetPort: calico-typha) doesn't follow the naming convention of Istio port.
Info [IST0118] (Service metallb-system/metallb-webhook-service) Port name  (port: 443, targetPort: 9443) doesn't follow the naming convention of Istio port.

Do not act on the IST0102 suggestions for system namespaces. Injecting sidecars into Calico or MetalLB breaks the components the mesh itself runs on. Label them istio-injection=disabled if you want the noise gone. IST0118 means Istio can’t infer the protocol from the port name, which only matters for Services that join the mesh.

Deploy two versions of podinfo

Create three namespaces: demo gets sidecar injection, demo-ambient joins the ambient data plane, and legacy stays outside the mesh to play the client that hasn’t been migrated yet:

kubectl create namespace demo
kubectl create namespace legacy
kubectl create namespace demo-ambient
kubectl label namespace demo istio-injection=enabled
kubectl label namespace demo-ambient istio.io/dataplane-mode=ambient
kubectl get namespace demo legacy demo-ambient --show-labels

Those two labels are the whole difference between the modes. Nothing else in the namespace changes, so moving a namespace later means swapping one label and restarting its pods.

NAME           STATUS   AGE   LABELS
demo           Active   2s    istio-injection=enabled,kubernetes.io/metadata.name=demo
legacy         Active   2s    kubernetes.io/metadata.name=legacy
demo-ambient   Active   1s    istio.io/dataplane-mode=ambient,kubernetes.io/metadata.name=demo-ambient

The canary pair is two Deployments of podinfo that share the app: podinfo label and differ only in version. The Service selects on app alone, so it covers both, and the DestinationRule later splits them by the version label. Version 6.16.0 plays the current release and 6.17.0 the canary. Open the manifest:

vim podinfo-demo.yaml

Paste both Deployments and the Service. The Service port is named http, which is what Istio reads to treat the traffic as HTTP instead of opaque TCP.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: podinfo-v1
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: podinfo
      version: v1
  template:
    metadata:
      labels:
        app: podinfo
        version: v1
    spec:
      containers:
      - name: podinfo
        image: ghcr.io/stefanprodan/podinfo:6.16.0
        ports:
        - containerPort: 9898
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podinfo-v2
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: podinfo
      version: v2
  template:
    metadata:
      labels:
        app: podinfo
        version: v2
    spec:
      containers:
      - name: podinfo
        image: ghcr.io/stefanprodan/podinfo:6.17.0
        ports:
        - containerPort: 9898
---
apiVersion: v1
kind: Service
metadata:
  name: podinfo
  namespace: demo
spec:
  selector:
    app: podinfo
  ports:
  - name: http
    port: 80
    targetPort: 9898

Next comes the client. Create client-demo.yaml with a plain curl Deployment, because testing mTLS from your laptop proves nothing: the ingress gateway is itself an Envoy with a mesh identity, so only an in cluster caller shows what STRICT does to plaintext.

vim client-demo.yaml

It does nothing but sleep, so you can kubectl exec curl from inside the namespace and see the mesh the way another service sees it.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: client
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: client
  template:
    metadata:
      labels:
        app: client
    spec:
      containers:
      - name: curl
        image: curlimages/curl:8.23.0
        command: ["sleep", "infinity"]

Save a copy as client-legacy.yaml and change only namespace: demo to namespace: legacy. Then apply all three files:

kubectl apply -f podinfo-demo.yaml
kubectl -n demo rollout status deploy/podinfo-v1
kubectl -n demo rollout status deploy/podinfo-v2
kubectl -n demo get pods
kubectl apply -f client-legacy.yaml -f client-demo.yaml

Once both rollouts finish, the listing shows the two podinfo pods. Each should show 2/2, because the injector added a proxy to each one. A pod at 1/1 means the label went on after the pod started.

NAME                          READY   STATUS    RESTARTS   AGE
podinfo-v1-86db95dd57-mnxg8   2/2     Running   0          6s
podinfo-v2-fcc7bdf5-ptwpl     2/2     Running   0          6s

Where that proxy lives has changed. Istio now injects istio-proxy as a Kubernetes native sidecar, an init container that keeps running, so it starts before your app and stops after it. Print the container lists to confirm:

kubectl -n demo get pod -l version=v1 -o jsonpath="{.items[0].spec.containers[*].name} {.items[0].spec.initContainers[*].name}{\"\n\"}"

The output puts podinfo first, as the only regular container. The other two names come from initContainers, which does not look like a running proxy at first glance.

podinfo istio-validation istio-proxy

Scripts that grep .spec.containers for istio-proxy to decide whether a pod is meshed will miss it now. Check initContainers as well, or use istioctl proxy-status instead.

Enforce STRICT mTLS

By default the mesh runs in PERMISSIVE mode: sidecars accept both mTLS and plaintext, so nothing breaks the day you install Istio. You can see the difference in the headers podinfo echoes back. A call from the meshed client carries an X-Forwarded-Client-Cert header with the caller’s SPIFFE ID:

kubectl -n demo exec deploy/client -c curl -- curl -s http://podinfo.demo/headers

Look for the XFCC entry in the JSON that comes back. The receiving sidecar adds it only after a successful mTLS handshake, so its presence is the quickest proof that a given call was encrypted and authenticated. Podinfo is useful here because it echoes request headers back, which most real services don’t.

  "X-Forwarded-Client-Cert": [
    "By=spiffe://cluster.local/ns/demo/sa/default;Hash=7ba319aea4949caaaf721aa6088232b39efc65e34f7408844beffa5be58ba5ab;Subject=\"\";URI=spiffe://cluster.local/ns/demo/sa/default"
  ],

The same request from the legacy namespace returns HTTP 200 and no XFCC header at all. That’s plaintext crossing your mesh, and PERMISSIVE allows it. To stop it, create a namespace wide PeerAuthentication:

vim peer-authentication.yaml

Name it default and leave out the selector, so it applies to every workload in demo. Scoping it to one namespace keeps the blast radius small while you find out which callers break. Once every namespace runs STRICT cleanly, a single mesh wide policy in istio-system replaces them all.

apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
  name: default
  namespace: demo
spec:
  mtls:
    mode: STRICT

Apply it, then call podinfo from the plaintext client with verbose curl so you see exactly where the connection dies:

kubectl apply -f peer-authentication.yaml
kubectl -n legacy exec deploy/client -c curl -- curl -sv http://podinfo.demo/version; echo "exit=$?"

TCP connects and the request goes out. Then the sidecar on the podinfo side drops it, because it expects a TLS handshake and gets a plain HTTP request.

Istio STRICT PeerAuthentication rejecting a plaintext client with Recv failure: Connection reset by peer and curl exit code 56

Notice what’s missing: no HTTP status, no error body, nothing in the response that mentions TLS. The meshed client in demo still gets 200, so the service is fine. When a team reports random Connection reset by peer errors right after an mTLS rollout, check whether the caller has a sidecar before you look at the network.

When several PeerAuthentications exist at mesh, namespace and workload level, it is not obvious which one wins. istioctl x describe tells you.

istioctl x describe pod $(kubectl -n demo get pod -l version=v1 -o jsonpath="{.items[0].metadata.name}") -n demo

Its last lines name both the effective mode and the resource that set it. Run this whenever a policy seems ignored, because a workload level PeerAuthentication with a selector overrides the namespace default without any warning. A mesh wide policy in istio-system sits underneath both, so check all three levels before you blame the proxy.

Effective PeerAuthentication:
   Workload mTLS mode: STRICT
Applied PeerAuthentication:
   default.demo

That confirms the reset came from policy, not from the network. With the cause pinned down, the fix belongs on the client side.

Fix “Recv failure: Connection reset by peer” from a plaintext client

Give the caller an identity instead of loosening the server. Label the legacy namespace for injection and restart the client so the new pod picks up a sidecar:

kubectl label namespace legacy istio-injection=enabled
kubectl -n legacy rollout restart deploy client

The new pod comes up 2/2, the same request returns 200, and podinfo now sees the caller as spiffe://cluster.local/ns/legacy/sa/default:

Legacy namespace labelled for Istio injection, client restarted with 2/2 containers and the X-Forwarded-Client-Cert header carrying its SPIFFE ID

Labelling the namespace alone changes nothing for pods that already run. Injection happens at pod creation, so the restart is the step people forget. If the caller can’t join the mesh at all, such as a VM or a managed service outside the cluster, add a second PeerAuthentication with a workload selector for podinfo and a portLevelMtls PERMISSIVE entry on container port 9898, not Service port 80, rather than turning STRICT off for the whole namespace. Port level settings only apply when a selector is present, so adding them to the namespace wide default policy does nothing. For the rest of this guide we put legacy back to plaintext for the ambient test, so drop the label and restart the client once more:

kubectl label namespace legacy istio-injection-
kubectl -n legacy rollout restart deploy client
kubectl -n legacy rollout status deploy/client

The namespace reports namespace/legacy unlabeled, and the replacement pod comes up 1/1 again while the injected 2/2 pod terminates.

Split traffic 90/10 with a VirtualService

A canary in Istio takes three resources. The Gateway opens port 80 on the ingress gateway, the DestinationRule names the v1 and v2 subsets by pod label, and the VirtualService assigns each subset a weight. Start with the Gateway:

vim gateway.yaml

Its selector istio: ingressgateway matches the gateway pods the install created. If you named the gateway differently at install time, check the pod labels first, since a selector that matches nothing leaves port 80 closed and the curl tests time out.

apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: podinfo-gw
  namespace: demo
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"

Now the DestinationRule, saved as destination-rule.yaml. It must exist before any route names a subset, so apply it with or before the VirtualService.

vim destination-rule.yaml

Each subset is only a label selector inside the Service’s endpoints. Istio creates one Envoy cluster per subset, which is what the weights point at.

apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
  name: podinfo
  namespace: demo
spec:
  host: podinfo.demo.svc.cluster.local
  subsets:
  - name: v1
    labels:
      version: v1
  - name: v2
    labels:
      version: v2

Finally, create the VirtualService that carries the weights. It binds to the Gateway by name, so the gateways field has to match podinfo-gw exactly. Leave that field out and the rules apply to traffic inside the mesh instead of at the gateway, so the curl loop from outside would never see the split.

vim virtual-service-90-10.yaml

Ninety percent goes to v1 and ten to v2. Keep the weights adding up to 100 so each number reads directly as a percentage of requests.

apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: podinfo
  namespace: demo
spec:
  hosts:
  - "*"
  gateways:
  - podinfo-gw
  http:
  - route:
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v1
      weight: 90
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v2
      weight: 10

Apply the three files together so the VirtualService never points at subsets that do not exist yet:

kubectl apply -f gateway.yaml -f destination-rule.yaml -f virtual-service-90-10.yaml

Before you count anything, create the 50/50 file you’ll switch to halfway through. It is the same VirtualService with both weights at 50, so applying it later replaces the 90/10 route in place.

vim virtual-service-50-50.yaml

Paste this version, which only changes the two weights.

apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: podinfo
  namespace: demo
spec:
  hosts:
  - "*"
  gateways:
  - podinfo-gw
  http:
  - route:
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v1
      weight: 50
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v2
      weight: 50

Do not trust the weights until you’ve counted them. Run these loops from a cluster node or a host on the MetalLB L2 segment, since a workstation in another network can’t reach the pool address. Each loop sends 1,000 requests through the gateway and tallies the version each one hit, with the 50/50 file applied between the two runs.

time ( for i in $(seq 1 1000); do curl -s http://${INGRESS_LB_IP}/version | jq -r .version; done | sort | uniq -c )
kubectl apply -f virtual-service-50-50.yaml
time ( for i in $(seq 1 1000); do curl -s http://${INGRESS_LB_IP}/version | jq -r .version; done | sort | uniq -c )

We got 905 to 95 at 90/10 and 498 to 502 at 50/50, each run taking about 13 seconds.

Istio canary split measured with a 1000-request curl loop: 905 to 95 at 90/10 weights and 498 to 502 at 50/50

Envoy picks a subset per request at random, weighted, so small samples drift. Our first run at 90/10 used only 100 requests, and it came back 92 to 8.

     92 6.16.0
      8 6.17.0

real	0m1.353s
user	0m0.682s
sys	0m0.813s

That is two points off the target from sampling noise alone, with nothing wrong in the route. Measure the canary’s error rate over a few thousand requests before you promote it, not over the first hundred.

Route testers to the canary with a header

Weights expose real users to v2. To let only your testers see it first, match on a request header. The first rule that matches wins, so the header rule goes above the default route:

vim virtual-service-header.yaml

Requests with x-canary: true go to v2 and everything else goes to v1. Istio expects header keys in lower case in the match, so keep the key written that way in the YAML.

apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: podinfo
  namespace: demo
spec:
  hosts:
  - "*"
  gateways:
  - podinfo-gw
  http:
  - match:
    - headers:
        x-canary:
          exact: "true"
    route:
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v2
  - route:
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v1

Apply it, then send 20 requests with the header and 20 without. Twenty is enough here, because a header match isn’t sampled the way weights are.

kubectl apply -f virtual-service-header.yaml
for i in $(seq 1 20); do curl -s -H "x-canary: true" http://${INGRESS_LB_IP}/version | jq -r .version; done | sort | uniq -c
for i in $(seq 1 20); do curl -s http://${INGRESS_LB_IP}/version | jq -r .version; done | sort | uniq -c

Unlike the weighted route, this split is exact. There is no randomness involved, because the decision depends only on the header.

     20 6.17.0
     20 6.16.0

Hand rolling these weight changes works for a lab. For automated promotion based on metrics, Argo Rollouts can drive the same VirtualService for you and roll back when error rates climb.

Catch broken routes with istioctl analyze

kubectl apply accepts a VirtualService that points at a subset nobody defined, and the gateway then answers every request with a 503. istioctl analyze catches that before your users do. To see it, point the route at a v3 subset the DestinationRule does not have:

vim virtual-service-broken-v3.yaml

The whole file is one route and one bad subset name. A typo like this is easy to make during a rollback at 2 a.m., which is exactly when nobody reads the YAML twice. Kubernetes validates the schema, not the references, so the apply succeeds and the outage starts quietly.

apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: podinfo
  namespace: demo
spec:
  hosts:
  - "*"
  gateways:
  - podinfo-gw
  http:
  - route:
    - destination:
        host: podinfo.demo.svc.cluster.local
        subset: v3

Apply it, run istioctl analyze -n demo, then put the working 90/10 route back and analyze again.

istioctl analyze reporting Error IST0101 for a VirtualService subset v3 missing from the DestinationRule, then a clean result after the fix

While the broken route was live, curl through the gateway returned this. An empty body from istio-envoy tells you Envoy found no cluster for the missing subset, not that podinfo failed:

HTTP/1.1 503 Service Unavailable
date: Sun, 29 Nov 2026 07:37:43 GMT
server: istio-envoy
content-length: 0

IST0101 is an Error, and istioctl analyze exits non zero on it, so it is safe to run in CI against your manifests before they reach the cluster. The analyzer also flags softer problems. A plain nginx Deployment in a scratch namespace with an unnamed Service port produced two Info messages:

Info [IST0102] (Namespace scratch) The namespace is not enabled for Istio injection. Run 'kubectl label namespace scratch istio-injection=enabled' to enable it, or 'kubectl label namespace scratch istio-injection=disabled' to explicitly mark it as not needing injection.
Info [IST0118] (Service scratch/web) Port name  (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port.

Fix IST0118 on any Service that joins the mesh, because without a protocol hint Istio may treat HTTP as raw TCP and your VirtualService HTTP routes stop applying to it. Either of these works:

  • A port name with a protocol prefix: http, http-web, grpc, tcp
  • An appProtocol: http field on the Service port

Prefixes work too, so http-metrics counts as HTTP. The application requirements page lists the accepted names.

Run the same workload in ambient mode

Ambient mode drops the per pod sidecar. A ztunnel DaemonSet on each node handles mTLS at layer 4 and carries traffic between workloads over HBONE, an HTTP CONNECT tunnel on port 15008. You only add a waypoint proxy when a namespace needs layer 7 features such as header routing. Ambient doesn’t need a canary pair, so podinfo-ambient.yaml holds one Deployment named podinfo on 6.17.0 plus its Service:

vim podinfo-ambient.yaml

Paste the Deployment and Service. Notice there is no sidecar setting anywhere, because the namespace label alone puts these pods in the mesh.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: podinfo
  namespace: demo-ambient
spec:
  replicas: 1
  selector:
    matchLabels:
      app: podinfo
  template:
    metadata:
      labels:
        app: podinfo
    spec:
      containers:
      - name: podinfo
        image: ghcr.io/stefanprodan/podinfo:6.17.0
        ports:
        - containerPort: 9898
---
apiVersion: v1
kind: Service
metadata:
  name: podinfo
  namespace: demo-ambient
spec:
  selector:
    app: podinfo
  ports:
  - name: http
    port: 80
    targetPort: 9898

For the client, copy client-demo.yaml to client-ambient.yaml with namespace: demo-ambient. Apply both and check what ztunnel sees:

kubectl apply -f podinfo-ambient.yaml -f client-ambient.yaml
kubectl -n demo-ambient get pods -o wide
istioctl ztunnel-config workloads | grep -E "NAMESPACE|demo-ambient"

The pods are 1/1 and ztunnel lists them with protocol HBONE. Next, apply a STRICT PeerAuthentication to demo-ambient (the same file as before with the namespace changed, saved as peer-authentication-ambient.yaml) and repeat the plaintext test:

kubectl apply -f peer-authentication-ambient.yaml
kubectl -n legacy exec deploy/client -- curl -sv http://podinfo.demo-ambient/version; echo "exit=$?"

Here is the result next to the ztunnel workload list from the step before.

istioctl ztunnel-config workloads showing HBONE for the demo-ambient pods, and STRICT mTLS resetting the plaintext client in ambient mode

The plaintext client gets the same reset and exit 56 as it did against the sidecar namespace, so your troubleshooting carries over unchanged. Proof that traffic really goes through ztunnel is in its access log, which records both SPIFFE identities and the HBONE port for every connection:

kubectl -n istio-system logs $(kubectl -n istio-system get pod -l app=ztunnel --field-selector spec.nodeName=k8s-worker01 -o name) --tail=4

Our podinfo pod ran on k8s-worker01, so swap in the node from the NODE column of the get pods -o wide output above, since ztunnel logs the inbound side on the receiving node. Here is one inbound line from that log. Both SPIFFE identities and the 15008 tunnel port are in it, so it does the same job XFCC did for sidecars when you need to prove a call was authenticated. Ambient pods carry no proxy of their own, so the ztunnel log on the receiving node is the only place this evidence lives.

2026-11-29T07:38:26.984914Z	info	access	connection complete	src.addr=192.168.79.90:56478 src.workload="client-7989664988-rz9zr" src.namespace="demo-ambient" src.identity="spiffe://cluster.local/ns/demo-ambient/sa/default" src.cluster="Kubernetes" dst.addr=192.168.79.89:15008 dst.hbone_addr=192.168.79.89:9898 dst.service="podinfo.demo-ambient.svc.cluster.local" dst.workload="podinfo-57fdc6f4d7-887xl" dst.namespace="demo-ambient" dst.identity="spiffe://cluster.local/ns/demo-ambient/sa/default" dst.cluster="Kubernetes" direction="inbound" bytes_sent=237 bytes_recv=91 duration="2ms"

Sidecar and ambient workloads also talk to each other with mTLS intact. The ambient client calling podinfo.demo and the sidecar client calling podinfo.demo-ambient both returned 200, and the sidecar side saw the ambient caller as URI=spiffe://cluster.local/ns/demo-ambient/sa/default. You can migrate one namespace at a time.

Compare sidecar and ambient overhead

Ambient costs less memory and less latency than sidecars on this cluster, by a wide margin. Memory came from kubectl top with the whole lab running.

ComponentCountMemory each
istiod1 per cluster53Mi
istio-ingressgateway130Mi
istio-cni-node1 per node14 to 18Mi
ztunnel1 per node3 to 5Mi
istio-proxy sidecar1 per pod29 to 33Mi, 5m CPU

Sidecar memory is the line that scales. Each sidecar used more memory than the podinfo container next to it (17 to 24Mi), so 200 meshed pods pay roughly 6 GiB for proxies, while ztunnel stays a few MiB per node. For latency we ran Fortio from inside each namespace at 100 requests per second for 30 seconds over 8 connections, 3,000 calls per case. One more namespace, nomesh, with no labels at all gives the baseline. Create it and open the Fortio manifest:

kubectl create namespace nomesh
vim fortio-demo.yaml

Fortio runs in server mode and does nothing until you exec a load test into it. Save copies as fortio-ambient.yaml and fortio-nomesh.yaml with only the namespace changed, and do the same with podinfo-ambient.yaml to get podinfo-nomesh.yaml, changing both of its namespace lines.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: fortio
  namespace: demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: fortio
  template:
    metadata:
      labels:
        app: fortio
    spec:
      containers:
      - name: fortio
        image: fortio/fortio:1.77.0
        args: ["server"]

Apply the four files. The demo copy comes up 2/2 with a sidecar, while the ambient and nomesh copies stay 1/1, which is exactly the comparison we want. Our lab pulled the untagged fortio/fortio image on 29 November 2026, which Docker Hub shows was the same digest as the 1.77.0 tag, so the manifest pins that tag to keep reruns comparable with these numbers.

kubectl apply -f podinfo-nomesh.yaml -f fortio-nomesh.yaml -f fortio-demo.yaml -f fortio-ambient.yaml

Then run the same load from each namespace against its own podinfo. The sidecar pod needs -c fortio because it has two containers:

kubectl -n nomesh exec deploy/fortio -- fortio load -qps 100 -t 30s -c 8 http://podinfo.nomesh/version
kubectl -n demo exec deploy/fortio -c fortio -- fortio load -qps 100 -t 30s -c 8 http://podinfo.demo/version
kubectl -n demo-ambient exec deploy/fortio -- fortio load -qps 100 -t 30s -c 8 http://podinfo.demo-ambient/version

Every run returned Code 200 : 3000 (100.0 %). These are the percentiles from the first run.

Data planep50p90p99Average
No mesh0.61 ms0.95 ms1.79 ms0.70 ms
Sidecar (STRICT)3.39 ms3.96 ms4.97 ms3.35 ms
Ambient (STRICT)1.50 ms1.91 ms2.36 ms1.38 ms

A second run matched p50, p90 and the averages within a few hundredths of a millisecond, with averages of 3.32 ms for sidecars and 1.36 ms for ambient, while ambient p99 dropped to 2.00 ms. Sidecars add about 2.7 ms per hop because the request crosses two Envoys, while ambient adds about 0.7 ms through ztunnel. Those are small numbers next to a database call, but they stack up across a chain of five services. Our verdict: start new namespaces in ambient, and keep sidecars only where you need layer 7 policy on every pod and do not want to run waypoints.

Watch the canary in Kiali

Kiali draws the mesh from Prometheus metrics, so you can watch the canary split live instead of counting curl output. Both ship in the release directory you downloaded earlier:

cd ~/istio-* && kubectl apply -f samples/addons/prometheus.yaml -f samples/addons/kiali.yaml && cd ~
kubectl -n istio-system rollout status deploy/kiali

Sample Kiali runs without login and has no TLS, so do not expose it through the ingress gateway. Forward it to localhost on the control plane, then tunnel to it from your workstation with ssh -L 20001:127.0.0.1:20001:

kubectl -n istio-system port-forward svc/kiali 20001:20001 --address 127.0.0.1

With the 90/10 route applied and a curl loop running, open http://127.0.0.1:20001/kiali, go to Traffic Graph, select demo, demo-ambient and istio-system in the namespace picker and switch to the versioned app graph:

Kiali versioned app graph showing the istio-ingressgateway splitting podinfo traffic between v1 and v2, plus the demo-ambient namespace

The edge labels in that screenshot read 83.3% to v1 and 16.7% to v2. Kiali averages over a short window at a low request rate, so it drifts from 90/10 the same way a 100 request sample does. Use it to see that both subsets get traffic and that the success rate is 100%, and use the curl count or your metrics for the actual ratio. The ambient namespace shows up in the same graph, so one view covers both data planes. For dashboards that outlive the sample addons, wire the mesh into a Prometheus and Grafana stack.

Debug routing with istioctl proxy-config

When traffic goes somewhere you didn’t expect, ask Envoy what config it actually holds. These three commands answer most routing questions. First check that the subsets exist as Envoy clusters.

istioctl proxy-config cluster $(kubectl -n demo get pod -l version=v1 -o jsonpath="{.items[0].metadata.name}").demo | grep podinfo

You should get one cluster per subset plus the plain Service. A missing subset row here means the DestinationRule did not match any pod labels.

podinfo.demo.svc.cluster.local                                      80        -          outbound      EDS              podinfo.demo
podinfo.demo.svc.cluster.local                                      80        v1         outbound      EDS              podinfo.demo
podinfo.demo.svc.cluster.local                                      80        v2         outbound      EDS              podinfo.demo

Then confirm the gateway bound your VirtualService to its listener. This is the check to run when curl through the gateway returns 404, because a VirtualService that never attached leaves the gateway with no route. The podinfo.demo row is simply absent in that case.

istioctl proxy-config routes deploy/istio-ingressgateway -n istio-system

Look for podinfo.demo in the VIRTUAL SERVICE column. If it is missing, the Gateway name or namespace in the VirtualService does not match.

NAME          VHOST NAME     DOMAINS     MATCH                  VIRTUAL SERVICE
http.8080     *:80           *           /*                     podinfo.demo
              backend        *           /stats/prometheus*
              backend        *           /healthz/ready*        

The workload certificate is the identity STRICT mode checks. This pipeline pulls it from the sidecar and prints its SAN:

istioctl proxy-config secret $(kubectl -n demo get pod -l version=v1 -o jsonpath="{.items[0].metadata.name}").demo -o json | jq -r '.dynamicActiveSecrets[] | select(.name=="default") | .secret.tlsCertificate.certificateChain.inlineBytes' | base64 -d | openssl x509 -noout -ext subjectAltName -issuer

The SAN it prints is the SPIFFE ID built from the namespace and service account. AuthorizationPolicies match on exactly this string, so it is worth knowing where it comes from before you write one. Change a pod’s service account and its identity changes with it, which silently breaks any policy written against the old name.

X509v3 Subject Alternative Name: critical
    URI:spiffe://cluster.local/ns/demo/sa/default
issuer=O=cluster.local

Without the jq filter, the proxy-config secret view showed this certificate valid for 24 hours, while the root CA runs for ten years. The istio agent in each proxy requests a new cert well before expiry and istiod signs it, which is one reason it has to stay up. Every pod here runs as the default service account, so all of them share one identity. Give each workload its own service account before you write AuthorizationPolicies, and see our RBAC and service accounts guide for how to set that up.

Test what happens when istiod goes down

Running traffic survives a control plane outage, but new pods don’t. We scaled istiod to zero to see where the line falls:

kubectl -n istio-system scale deploy istiod --replicas=0

Then we sent traffic, created a pod and restarted a Deployment. Those three actions cover what a cluster does on its own during an outage: serve requests, schedule new work and replace pods. Each one depends on istiod in a different way, so they fail differently.

for i in $(seq 1 20); do curl -s -o /dev/null -w "%{http_code}\n" http://${INGRESS_LB_IP}/version; done | sort | uniq -c
kubectl -n demo run test-pod --image=curlimages/curl -- tail -f /dev/null
kubectl -n demo rollout restart deploy podinfo-v1
kubectl -n demo rollout status deploy/podinfo-v1 --timeout=20s
kubectl -n demo get events --field-selector reason=FailedCreate

The screenshot below catches the two loudest results with the control plane gone: the traffic tally and the webhook refusal.

With istiod scaled to zero, ingress traffic still returns 200 but new pods fail on the namespace.sidecar-injector.istio.io webhook

All 20 requests through the gateway returned 200, because every Envoy keeps its last config. Pod creation failed outright, because the sidecar injector webhook is served by istiod and its failure policy is Fail. This is the error you will see.

Error from server (InternalError): Internal error occurred: failed calling webhook "namespace.sidecar-injector.istio.io": failed to call webhook: Post "https://istiod.istio-system.svc:443/inject?timeout=10s": dial tcp 10.102.113.192:443: connect: connection refused

The restarted Deployment is the quieter trap. kubectl rollout restart reports success, the old pod keeps serving, and the new ReplicaSet just logs FailedCreate events while the rollout hangs. Watch for FailedCreate events in meshed namespaces, because with istiod down, HPA scale outs fail and pods evicted by a node drain can’t come back. Bring the control plane back before you move on, or the rest of the cluster stays unable to start meshed pods:

kubectl -n istio-system scale deploy istiod --replicas=1
kubectl -n istio-system rollout status deploy/istiod
kubectl -n demo rollout status deploy/podinfo-v1
kubectl -n demo run test-pod --image=curlimages/curl -- tail -f /dev/null
kubectl -n demo get pod test-pod
kubectl -n demo delete pod test-pod

Scaling istiod back to 1 needed no other action. The stuck podinfo rollout finished by itself within seconds, and the same test pod the webhook refused earlier was now admitted with both init containers (Init:0/2), so injection works again before you delete it.

Remove Istio from the cluster

If you installed Kiali and Prometheus, remove them before anything else with kubectl delete -f samples/addons/kiali.yaml -f samples/addons/prometheus.yaml from the istio-1.32.0 directory, because their ClusterRoles and bindings outlive the namespace. Then delete the test namespaces so no pod is left with a sidecar that points at a missing control plane, and purge Istio, which removes the CRDs and webhooks as well:

kubectl delete namespace demo demo-ambient legacy nomesh
istioctl uninstall --purge -y
kubectl delete namespace istio-system
kubectl get crd | grep -c istio.io

The final count should be 0. Drop nomesh from the list if you skipped the Fortio baseline, and use istioctl uninstall --revision <name> instead of --purge when another revision must stay installed.

Harden the mesh before production

The lab took shortcuts that a production mesh cannot afford. These are the changes we’d make first, in order.

  1. Run istiod with at least two replicas and a PodDisruptionBudget
  2. Apply STRICT PeerAuthentication in istio-system for the whole mesh
  3. Give each workload its own service account, then add AuthorizationPolicies
  4. Run istioctl analyze in CI on every manifest change
  5. Upgrade with revisions and tags instead of in place

The istiod drill is why the first item comes first: a single replica turns a node drain into meshed namespaces where nothing can schedule. Pair the mesh with Pod Security Standards, since the istio-cni plugin removes the NET_ADMIN init container that the baseline and restricted profiles reject. Restricted namespaces also need a seccompProfile on every app, which CNI does not add for you. AuthorizationPolicies decide who may call whom at runtime, but they can’t stop someone deploying a pod without a service account or with injection disabled, so enforce that at admission with a policy engine, compared in our OPA Gatekeeper vs Kyverno guide. If you route north to south through the Kubernetes Gateway API instead of Istio’s own Gateway, the Gateway API migration guide covers that side. Plenty of mesh trouble turns out to be cluster trouble underneath, so keep the kubectl cheat sheet close when a webhook, Service or DNS lookup is the real culprit.

Keep reading

Best UI Applications for Managing Docker Containers Containers Best UI Applications for Managing Docker Containers Install Docker and Run Containers on Ubuntu 24.04|22.04 Containers Install Docker and Run Containers on Ubuntu 24.04|22.04 Install UniFi OS Server on Ubuntu 26.04 / 24.04 LTS Containers Install UniFi OS Server on Ubuntu 26.04 / 24.04 LTS Traefik 3.8 Upgrade: Breaking Changes, Yaegi v2 and Helm Test Containers Traefik 3.8 Upgrade: Breaking Changes, Yaegi v2 and Helm Test magpie: One AI Gateway for Claude Code and Codex on Linux AI magpie: One AI Gateway for Claude Code and Codex on Linux WSL Containers (wslc) on Windows 11: Setup, Benchmark vs Docker Containers WSL Containers (wslc) on Windows 11: Setup, Benchmark vs Docker

Leave a Comment

Press ESC to close