Enabling mTLS in Istio
What you'll learn: How to configure PeerAuthentication policies in Istio to enforce mutual TLS between services, either strictly or with gradual adoption in mind.
What is PeerAuthentication?
Now that you understand mTLS fundamentals and service identity, it's time to actually turn it on. Istio uses a resource called PeerAuthentication to control how services authenticate with each other. Think of it as a switch that determines whether services must use mTLS (strict mode) or can use it alongside plain HTTP (permissive mode).
The Two Modes
Strict mode requires all service-to-service communication to use mTLS. If a service tries to connect without a valid certificate, the request is rejected. This gives you maximum security.
Permissive mode allows both mTLS and plain-text traffic. This is your migration tool—services with sidecars use mTLS automatically, while legacy services without sidecars can still communicate. It's like having a door that accepts both keycards and old-fashioned keys during a transition period.
Configuration Levels
You can apply PeerAuthentication at three levels:
- Mesh-wide: Default policy for everything
- Namespace-level: Override for specific namespaces
- Workload-level: Fine-grained control per service
More specific policies override broader ones.
Example Policy
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: production
spec:
mtls:
mode: STRICT
This enforces strict mTLS for all services in the production namespace. Change STRICT to PERMISSIVE for gradual adoption.
Key Takeaway: PeerAuthentication policies let you control mTLS enforcement granularly—use PERMISSIVE mode during migration and STRICT for production-grade security once all services have sidecars.