- How mTLS works with sidecar proxies and SPIFFE identities.
- How to configure mTLS modes with
PeerAuthentication. - How to apply service-level access control using
AuthorizationPolicyand SPIFFE identities.

Why mTLS matters
Kubernetes networking is plaintext by default. That creates three main risks:- A compromised pod can sniff node-local traffic — exposing API keys, credentials, and user data.
- There is no built-in service identity, so pods can impersonate one another.
- There is no native, easy way to enforce which services are allowed to call which.
- Encryption: traffic is encrypted in transit.
- Identity: each workload receives a SPIFFE certificate that encodes its trust domain, namespace, and service account.
- Authentication: callers are verified before connections are established.
How Istio implements mTLS
Istio’s control plane (Istiod) acts as a certificate authority. It issues short-lived X.509 certificates to each pod’s Envoy sidecar. Each certificate contains a SPIFFE URI identity such as: spiffe://cluster.local/ns/frontend/sa/web-app When pod A talks to pod B, the Envoy sidecars perform mutual TLS and validate each other’s certificates. Application code doesn’t need changes — apps continue to send plain HTTP. Encryption and identity verification happen at the sidecar layer.
Controlling mTLS with PeerAuthentication
Istio’sPeerAuthentication resource determines the mTLS mode for inbound traffic. The key field is spec.mtls.mode.
Common modes and recommended usage:
Example
PeerAuthentication to enforce strict mTLS for the payments namespace:
PeerAuthentication:
- A
PeerAuthenticationnameddefaultinistio-systemtypically sets a mesh-wide default. - A
PeerAuthenticationnameddefaultin a namespace affects only that namespace. - A
PeerAuthenticationwith aselectorapplies only to matching workloads (labels).
PeerAuthentication named default in that namespace with mode: STRICT.

AuthorizationPolicy: service-level RBAC using SPIFFE identities
WhilePeerAuthentication ensures encryption and identity, Istio’s AuthorizationPolicy enforces access control based on those identities. Policies reference SPIFFE URIs from mTLS certificates inside the principals field.
Example: allow only the web-app service account in the frontend namespace to call the payment-api service, and permit only GET and POST to /api/*:
- The
principalsvalue is the SPIFFE URI that the Envoy sidecars present during mTLS. - The default trust domain is often
cluster.localin typical Istio installs; adjust if your cluster uses a different trust domain.
Verifying mTLS and sidecar injection
Check thatPeerAuthentication resources are present and inspect their modes:
istioctl to inspect a pod and see the applied mTLS settings and relevant policies:
2/2 READY indicates the application container plus the istio-proxy sidecar:
1/1, no sidecar is injected and mTLS will not be applied for that pod.
Rolling out strict mTLS safely
Follow a staged rollout to avoid outages:- Enable automatic sidecar injection for the target namespace(s) and restart pods so they pick up the sidecar.
- Start with
PERMISSIVEmode at the mesh or namespace level so both mTLS and plaintext are accepted. This allows services not yet meshed to continue communicating. - Monitor traffic, Istio telemetry, and logs to detect and remediate failures.
- Once all workloads show sidecars and traffic is healthy, change the mode to
STRICTfor full enforcement.

Quick checklist
- Ensure sidecar injection is enabled for target namespaces.
- Confirm pods show
2/2READY (application + istio-proxy). - Start with
PERMISSIVEto avoid breaking traffic during migration. - Apply
PeerAuthentication(STRICT) once all workloads are meshed. - Use
AuthorizationPolicyto enforce service-to-service access using SPIFFE principals. - Validate with
istioctl x describe podandkubectlcommands.
Enable sidecar injection for the target namespaces and validate with
kubectl get pods -n <namespace> (look for 2/2 READY) before switching PeerAuthentication to STRICT.References
- Istio Service Mesh: https://learn.kodekloud.com/user/courses/istio-service-mesh
- SPIFFE: https://spiffe.io/
- Envoy Proxy: https://www.envoyproxy.io/